| | |
| | | // tagsview标签显示隐藏 |
| | | isCollapse: false, |
| | | // 顶部菜单索引 |
| | | currentIndex: 0 |
| | | currentIndex: 0, |
| | | // 路由同步顶级菜单时跳过首页跳转 |
| | | skipTopMenuNavigation: false |
| | | } |
| | | |
| | | const mutations = { |
| | |
| | | // 设置首页路由信息 |
| | | setTopMenuCurrent (state, current) { |
| | | console.log('setTopMenuCurrent', current) |
| | | state.skipTopMenuNavigation = false |
| | | if (current.id !== state.topMenuCurrent.id) { |
| | | state.topMenuList.list.forEach(item => { |
| | | state.topMenuList.list.forEach((item, index) => { |
| | | console.log(item.id, item.id) |
| | | if (current.id == item.id) { |
| | | state.topMenuCurrent = current |
| | | state.menuData.list = item.children |
| | | state.currentIndex = index |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | syncTopMenuFromRoute (state, { topMenu, topIndex }) { |
| | | if (!topMenu || topMenu.id === state.topMenuCurrent.id) { |
| | | return |
| | | } |
| | | state.skipTopMenuNavigation = true |
| | | state.topMenuCurrent = topMenu |
| | | state.menuData.list = topMenu.children || [] |
| | | state.currentIndex = topIndex |
| | | }, |
| | | // 重置菜单 |
| | | resetMenus: (state) => { |
| | | state.topMenuId = null |