mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
19 lines
451 B
TypeScript
19 lines
451 B
TypeScript
import Vue from 'vue'
|
||
|
||
/**
|
||
* 创建一个组件并动态注入 props
|
||
*
|
||
* 主要用于额外设置、小组件传入参数值
|
||
*
|
||
* 示例:extraOptions: () => import('./Setting.vue').then(m => createComponentWithProps(m.default, { isWidget: false })),
|
||
*/
|
||
export function createComponentWithProps(component: any, props: Record<string, any>) {
|
||
return Vue.extend({
|
||
render(h) {
|
||
return h(component, {
|
||
props,
|
||
})
|
||
},
|
||
})
|
||
}
|