Bilibili-Evolved/src/ui/vue-component-factory.ts
2025-08-14 21:19:07 +08:00

19 lines
451 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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,
})
},
})
}