diff --git a/package.json b/package.json index c2c15c91cb3623c2809262afd2a498c38666a3f3..a51ecebd0caaed3f7cef37fa40bd239ce759f392 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "axios": "^1.6.0", "element-plus": "^2.4.1", "guess": "^1.0.2", + "pinia": "^2.1.7", "vue": "^3.2.37", "vue-router": "^4.2.5" }, diff --git a/src/main.js b/src/main.js index 955d866645f8f5237157225a91fd06bb6ad8f346..6a10b59fa8d93ae00436909f07690f71a243e09a 100644 --- a/src/main.js +++ b/src/main.js @@ -4,12 +4,14 @@ import 'element-plus/dist/index.css' import router from './router/index' import App from './App.vue' import zhCn from 'element-plus/dist/locale/zh-cn.mjs' +import { createPinia } from 'pinia' - +const pinia = createPinia() const app = createApp(App); app.use(router); +app.use(pinia); app.use(ElementPlus, { locale: zhCn, -}) +}); app.mount('#app'); diff --git a/src/storage/routeStorage.js b/src/storage/routeStorage.js new file mode 100644 index 0000000000000000000000000000000000000000..d2354d9d3900eb27ce314af274faf58c82c6f5a1 --- /dev/null +++ b/src/storage/routeStorage.js @@ -0,0 +1,22 @@ +import { defineStore } from "pinia"; +import router from '@/router/index' + +export const useRouteStore = defineStore('route', { + state() { + return { + routeArr:[] + }; + }, + actions: { + add(roleId){ + if(roleId === '1'){ + routeArr.forEach(element => { + router.addRoute(element); + router.addRoute('/',element); + }); + }else{ + + } + } + } +}); \ No newline at end of file