|
|
@@ -1,18 +1,13 @@
|
|
|
import type { App } from 'vue'
|
|
|
-import ElEditor from './ElEditor.vue'
|
|
|
-import ElDict from './ElDict.vue'
|
|
|
-import ElFormTabs from './ElFormTabs.vue'
|
|
|
-import ElCustom from './ElCustom.vue'
|
|
|
-import ElArea from './ElArea.vue'
|
|
|
-import ImageUpload from './ImageUpload.vue'
|
|
|
+
|
|
|
+const modules = import.meta.glob('./form/*.vue', { eager: true })
|
|
|
|
|
|
function registerComponent(app: App): void {
|
|
|
- app.component('ElEditor', ElEditor)
|
|
|
- app.component('ElDict', ElDict)
|
|
|
- app.component('ElFormTabs', ElFormTabs)
|
|
|
- app.component('ElCustom', ElCustom)
|
|
|
- app.component('ElArea', ElArea)
|
|
|
- app.component('ElImageUpload', ImageUpload)
|
|
|
+ for (const key in modules) {
|
|
|
+ const name = key.replace(/^\.\/form\/|\.vue/g, '')
|
|
|
+ const component = (modules[key] as any).default
|
|
|
+ app.component(name, component)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export default registerComponent
|