fix: app启动报错问题修复

This commit is contained in:
2026-05-28 14:33:10 +08:00
parent 2eb5f30d74
commit 7a75f8b4bf
6 changed files with 70 additions and 23 deletions
+3 -2
View File
@@ -5,6 +5,7 @@ import piniaPersist from 'pinia-plugin-persist-uni';
const files = import.meta.glob('./*.js', { eager: true });
const modules = {};
Object.keys(files).forEach((key) => {
if (key === './index.js') return;
modules[key.replace(/(.*\/)*([^.]+).*/gi, '$2')] = files[key].default;
});
@@ -15,6 +16,6 @@ export const setupPinia = (app) => {
app.use(pinia);
};
export default (name) => {
export default function $store(name) {
return modules[name]();
};
}