forked from admin/deShanXiao
初始版本,目前线上可用
This commit is contained in:
11
frontEnd/src/util/globalComponents.ts
Normal file
11
frontEnd/src/util/globalComponents.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { App, defineAsyncComponent, defineComponent } from "vue"
|
||||
|
||||
const modulesComponent = import.meta.glob('../components/**/**.vue');
|
||||
|
||||
const install = (app: App) => {
|
||||
for(const [key , value] of Object.entries(modulesComponent)) {
|
||||
const name = key.slice(key.lastIndexOf('/') + 1, key.lastIndexOf('.'));
|
||||
app.component(name, defineAsyncComponent(value))
|
||||
}
|
||||
}
|
||||
export default install
|
||||
Reference in New Issue
Block a user