|
|
@@ -1,21 +1,7 @@
|
|
|
import { defineStore } from 'pinia'
|
|
|
import { ConstantStore } from '@/enum/store'
|
|
|
-import { ref, computed, onMounted, watch, reactive, watchEffect } from 'vue'
|
|
|
+import { reactive } from 'vue'
|
|
|
import RootRouter from '@/router'
|
|
|
-import { useSessionStorageState } from 'vue-hooks-plus'
|
|
|
-import { AppRouter as AppRouterEnum, Emitter } from '@/enum'
|
|
|
-import { useEmitter } from '@/hooks/index'
|
|
|
-import { useRoute } from 'vue-router'
|
|
|
-
|
|
|
-/**
|
|
|
- * 1. 获取当前路由path
|
|
|
- * 2. 从缓存中获取router, 防止刷新都丢失状态
|
|
|
- * 3. 获取navbar路由list
|
|
|
- * 3.1 根据当前的路由path 反推到最顶级父元素 将其置为常亮
|
|
|
- * 4. 每次点击navbar的路由的时候,将对应的sider第一项展开
|
|
|
- */
|
|
|
-
|
|
|
-const emitter = useEmitter()
|
|
|
|
|
|
const initAppRouterState: ROUTER.RouterRecords = {
|
|
|
navbar: {
|
|
|
@@ -44,10 +30,6 @@ export const useAppRouter = defineStore(ConstantStore.ROUTER, () => {
|
|
|
appRouter.sider.route = RootRouter.options.routes[0].children!
|
|
|
}
|
|
|
|
|
|
- const changeNavbar = (path: string) => {
|
|
|
- RootRouter.push(path)
|
|
|
- }
|
|
|
-
|
|
|
if (appRouter.navbar.route.length === 0) {
|
|
|
initAppRouter()
|
|
|
}
|