提交一下
This commit is contained in:
@@ -10,27 +10,22 @@ const install = function (Vue, params) {
|
||||
if (install.installed) return
|
||||
// 遍历注册全局组件
|
||||
let apps = []
|
||||
let contexts = require.context('.', true, /\.(\/.+)\/App[^\/]+\.vue$/)
|
||||
let contexts = import.meta.glob('./**/App*.vue')
|
||||
if (contexts) {
|
||||
contexts.keys().map(e => {
|
||||
if (contexts(e).default) {
|
||||
if (params?.apps) {
|
||||
if (params?.apps.includes(contexts(e).default.name)) {
|
||||
apps.push(contexts(e).default)
|
||||
Vue.component(contexts(e).default.name, contexts(e).default)
|
||||
}
|
||||
} else {
|
||||
apps.push(contexts(e).default)
|
||||
Vue.component(contexts(e).default.name, contexts(e).default)
|
||||
}
|
||||
Object.keys(contexts).map(path => {
|
||||
if (/App[A-Z]\w+\.vue/.test(path)) {
|
||||
return contexts?.[path]()?.then(file => {
|
||||
apps.push(file.default)
|
||||
return Vue.component(file.default.name, file.default)
|
||||
})
|
||||
}
|
||||
})
|
||||
!!params?.showList && console.log(apps.map(e => e.name))
|
||||
}
|
||||
core?.map(app => {
|
||||
apps.push(app.component)
|
||||
Vue.component(app.name, app.component)
|
||||
})
|
||||
!!params?.showList && console.log(apps.map(e => e.name))
|
||||
return Promise.resolve(apps)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user