18 lines
432 B
JavaScript
18 lines
432 B
JavaScript
// 导入当前目录下的所有图标组件
|
|
const files = import.meta.glob('./*.vue', {
|
|
eager: true,
|
|
import: 'default' // 可选,指定要导入的 export
|
|
})
|
|
const modules = {}
|
|
|
|
for (const path in files) {
|
|
// 获取组件名,可以根据需要修改这里的逻辑
|
|
const componentName = path.replace(/^\.\/(.*)\.\w+$/, '$1');
|
|
// 全局注册组件
|
|
modules[componentName] = files[path];
|
|
}
|
|
|
|
export default {
|
|
...modules
|
|
}
|