mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
refactor: 移动方法位置
This commit is contained in:
parent
f381226346
commit
d4ef2e6bc9
@ -2,8 +2,9 @@ import { defineComponentMetadata } from '@/components/define'
|
||||
import { ComponentEntry } from '@/components/types'
|
||||
import { addComponentListener } from '@/core/settings'
|
||||
import { select, selectAll } from '@/core/spin-query'
|
||||
import { createComponentWithProps } from '@/core/utils'
|
||||
import { useScopedConsole } from '@/core/utils/log'
|
||||
import { createComponentWithProps, RadioItem } from '@/ui'
|
||||
import { RadioItem } from '@/ui'
|
||||
|
||||
const componentName = 'hideHomeCarousel'
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { createComponentWithProps, RadioItem } from '@/ui'
|
||||
import { RadioItem } from '@/ui'
|
||||
import { ComponentEntry } from '@/components/types'
|
||||
import { defineComponentMetadata } from '@/components/define'
|
||||
import { createComponentWithProps } from '@/core/utils'
|
||||
|
||||
const componentName = 'removePromotions'
|
||||
|
||||
|
||||
@ -10,5 +10,5 @@
|
||||
"include": [
|
||||
"../src/**/*.d.ts",
|
||||
"lib/**/*.ts"
|
||||
, "../src/ui/vue-component-factory.ts" ],
|
||||
],
|
||||
}
|
||||
@ -714,3 +714,19 @@ export const simulateClick = (target: EventTarget, eventParams?: PointerEventIni
|
||||
export const getVue2Data = (el: any) =>
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
el.__vue__ ?? el.parentElement.__vue__ ?? el.children[0].__vue__ ?? el.__vueParentComponent
|
||||
|
||||
/**
|
||||
* 创建一个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,
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@ -27,5 +27,4 @@ export { default as OptionRadioGroup } from '@/ui/OptionRadioGroup.vue'
|
||||
export { type RadioItem } from '@/ui/radioItem'
|
||||
export { default as OptionWidgetLayout } from '@/ui/OptionWidgetLayout.vue'
|
||||
export { default as RadioGroupItem } from '@/ui/RadioGroupItem.vue'
|
||||
export { createComponentWithProps } from '@/ui/vue-component-factory'
|
||||
export { default as MiniToast } from '@/core/toast/MiniToast.vue'
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
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,
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user