This commit is contained in:
parent
d71f3dac09
commit
4eb561a822
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<subMenu :menuList="menuInfo.menuList" :collapse="menuInfo.collapse" :backgroundColor="menuInfo.backgroundColor"
|
||||
:textColor="menuInfo.textColor" :activeTextColor="menuInfo.activeTextColor" :defaultActive="menuInfo.defaultActive"
|
||||
:textColor="menuInfo.textColor" :activeTextColor="menuInfo.activeTextColor" :defaultActive="navStore.defaultActive"
|
||||
:defaultOpeneds="menuInfo.defaultOpeneds" :uniqueOpened="menuInfo.uniqueOpened" :menuTrigger="menuInfo.menuTrigger"
|
||||
:router="menuInfo.router" :collapseTransition="menuInfo.collapseTransition" :popperEffect="menuInfo.popperEffect"
|
||||
:isCustomLink="menuInfo.isCustomLink" :customLinkCallBack="menuInfo.customLinkCallBack"></subMenu>
|
||||
|
|
@ -33,6 +33,7 @@ const menuInfo: any = reactive({
|
|||
router.push({
|
||||
name: ev.path
|
||||
})
|
||||
navStore.setDefaultActive(ev)
|
||||
navStore.addNavTarget(ev)
|
||||
}
|
||||
})
|
||||
|
|
@ -53,9 +54,9 @@ const initRouteList = () => {
|
|||
// console.log("menuInfo.menuList",menuInfo.menuList)
|
||||
menuInfo.defaultOpeneds.push()
|
||||
const routes: any = list
|
||||
console.log("routes", routes)
|
||||
const currentNav = routes[0]
|
||||
if (navStore.topNavList) {
|
||||
console.log("routes", router)
|
||||
const currentNav = routes.find((ele:any)=>ele.meta.folder).children[0]
|
||||
if (navStore.topNavList.length == 0) {
|
||||
let firstNav = {
|
||||
title: currentNav.meta.title,
|
||||
name: currentNav.name,
|
||||
|
|
|
|||
|
|
@ -6,20 +6,20 @@ const routes: Array<RouteRecordRaw> = [
|
|||
path: '/',
|
||||
name: 'home',
|
||||
component: () => import('views/AppMain.vue'),
|
||||
redirect: '/index/swiperConfig',
|
||||
meta: {
|
||||
title: '主页面',
|
||||
keepAlive: true,
|
||||
AuthFlag: true,
|
||||
routeListRoot: true
|
||||
},
|
||||
children: []
|
||||
children: [],
|
||||
redirect: '/index/enterpriseType',
|
||||
},
|
||||
{
|
||||
path: '/index',
|
||||
name: 'index',
|
||||
component: () => import('views/AppMain.vue'),
|
||||
redirect: '/index/swiperConfig',
|
||||
|
||||
meta: {
|
||||
title: '主页面',
|
||||
keepAlive: true,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ export const list: any = [
|
|||
meta: {
|
||||
title: '企业管理',
|
||||
keepAlive: true,
|
||||
AuthFlag: true
|
||||
AuthFlag: true,
|
||||
folder:true
|
||||
},
|
||||
children: [
|
||||
|
||||
|
|
@ -100,7 +101,8 @@ export const list: any = [
|
|||
meta: {
|
||||
title: '企业装备管理',
|
||||
keepAlive: true,
|
||||
AuthFlag: true
|
||||
AuthFlag: true,
|
||||
folder:true
|
||||
},
|
||||
children: [
|
||||
// {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ export const comNavStore = defineStore('main_com_nav', {
|
|||
return {
|
||||
topNavList: [] as any, //loading控制,
|
||||
maxNavCount: 8,
|
||||
currentNav:''
|
||||
currentNav:'',
|
||||
defaultActive:''
|
||||
}
|
||||
},
|
||||
getters: {},
|
||||
|
|
@ -31,7 +32,13 @@ export const comNavStore = defineStore('main_com_nav', {
|
|||
setCurrentNav(ev:any){
|
||||
console.log("setCurrentNav")
|
||||
this.currentNav = ev
|
||||
} ,
|
||||
setDefaultActive(ev:any){
|
||||
console.log("setCurrentNav")
|
||||
this.defaultActive = ev.path+'&&'+ev.title
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
persist: {
|
||||
enabled: true, // 开启数据缓存
|
||||
|
|
@ -41,7 +48,7 @@ export const comNavStore = defineStore('main_com_nav', {
|
|||
key: 'main_com_nav',
|
||||
storage: sessionStorage, //缓存模式 可选 localStorage sessionStorage
|
||||
// state 中的字段名,按组打包储存
|
||||
paths: ['topNavList'] //需要缓存的字段 与 state中相关联
|
||||
paths: ['topNavList','currentNav','defaultActive'] //需要缓存的字段 与 state中相关联
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue