|
@@ -17,7 +17,7 @@ import { useRoute } from 'vue-router'
|
|
|
|
|
|
|
|
const emitter = useEmitter()
|
|
const emitter = useEmitter()
|
|
|
|
|
|
|
|
-const initAppRouterState: Router.RouterRecords = {
|
|
|
|
|
|
|
+const initAppRouterState: ROUTER.RouterRecords = {
|
|
|
navbar: {
|
|
navbar: {
|
|
|
route: [],
|
|
route: [],
|
|
|
selectPath: ''
|
|
selectPath: ''
|
|
@@ -29,11 +29,9 @@ const initAppRouterState: Router.RouterRecords = {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
export const useAppRouter = defineStore(ConstantStore.ROUTER, () => {
|
|
export const useAppRouter = defineStore(ConstantStore.ROUTER, () => {
|
|
|
- let appRouter = reactive<Router.RouterRecords>(initAppRouterState)
|
|
|
|
|
|
|
+ let appRouter = reactive<ROUTER.RouterRecords>(initAppRouterState)
|
|
|
|
|
|
|
|
- const route = useRoute()
|
|
|
|
|
-
|
|
|
|
|
- const [appRouterState, setAppRouterState] = useLocalStorageState<Router.RouterRecords>(AppRouterEnum.ROUTER, {
|
|
|
|
|
|
|
+ const [appRouterState, setAppRouterState] = useLocalStorageState<ROUTER.RouterRecords>(AppRouterEnum.ROUTER, {
|
|
|
defaultValue: initAppRouterState
|
|
defaultValue: initAppRouterState
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -63,7 +61,7 @@ export const useAppRouter = defineStore(ConstantStore.ROUTER, () => {
|
|
|
() => RootRouter.currentRoute.value.path,
|
|
() => RootRouter.currentRoute.value.path,
|
|
|
() => {
|
|
() => {
|
|
|
appRouter.sider = {
|
|
appRouter.sider = {
|
|
|
- route: RootRouter.getRoutes().find(item => item.path === appRouter.navbar!.selectPath)?.children as Router.RoutesProps[],
|
|
|
|
|
|
|
+ route: RootRouter.getRoutes().find(item => item.path === appRouter.navbar!.selectPath)?.children as ROUTER.RoutesProps[],
|
|
|
selectPath: RootRouter.currentRoute.value.path,
|
|
selectPath: RootRouter.currentRoute.value.path,
|
|
|
openKeys: [RootRouter.currentRoute.value.matched[1].path]
|
|
openKeys: [RootRouter.currentRoute.value.matched[1].path]
|
|
|
}
|
|
}
|
|
@@ -72,7 +70,7 @@ export const useAppRouter = defineStore(ConstantStore.ROUTER, () => {
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- appRouter = appRouterState.value as Router.RouterRecords
|
|
|
|
|
|
|
+ appRouter = appRouterState.value as ROUTER.RouterRecords
|
|
|
|
|
|
|
|
if (appRouter.navbar.route.length === 0) {
|
|
if (appRouter.navbar.route.length === 0) {
|
|
|
initAppRouter()
|
|
initAppRouter()
|