// 引入路由 import router from '@/router/index' import pinia from './store' import { constRouter } from '@/router/module/constRouter' import useSettingStore from '@/store/module/setting' const settingStore = useSettingStore(pinia) //重新指向pinia仓储 router.beforeEach((to, from, next) => { let index = constRouter[0].children.findIndex((item:any) => item.name === to.name); settingStore.setuseIndex(index) next() })