forked from drone/command-center-dashboard

shuishen
2025-04-02 e14358f85a7d32a753225f253ff223d17cf36c25
src/components/index.js
@@ -1,16 +1,15 @@
import { defineAsyncComponent } from 'vue'
export default {
    install (app) {
        // 匹配当前目录下所有.vue文件(包括子目录)
        const components = import.meta.glob('./global/*.vue', { eager: true })
   install(app) {
      // 匹配当前目录下所有.vue文件(包括子目录)
      const components = import.meta.glob('./global/*.vue', { eager: true })
        for (const [path, module] of Object.entries(components)) {
            // 提取组件名(去除路径和扩展名)
            const name = path.split('/').pop()?.replace('.vue', '') || ''
            // 注册组件
            app.component(name, (module).default)
        }
    }
}
      for (const [path, module] of Object.entries(components)) {
         // 提取组件名(去除路径和扩展名)
         const name = path.split('/').pop()?.replace('.vue', '') || ''
         // 注册组件
         app.component(name, module.default)
      }
   },
}