基于YOLOv5的地质灾害智能监测系统实战
2026/7/25 6:31:22
//使用pinia来管理全局状态import{createPinia}from'pinia'// 自动导入所有 store 文件constmodulesFiles=import.meta.glob('./modules/*.js',{eager:true})conststores={}for(constpathinmodulesFiles){constmoduleName=path.replace(/^\.\/modules\/(.*)\.\w+$/,'$1')stores[moduleName]=modulesFiles[path].default}// 安装所有 storeexportconstsetupStore=(app)=>{constpinia=createPinia()app.use(pinia)// 注册所有 storeObject.keys(stores).forEach(key=>{if(stores[key]&&typeofstores[key]==='function'){stores[key]()}})returnpinia}// 导出所有 storeexportdefaultstoresimport{setupStore}from'./store'constapp=createApp(App)setupStore(app)