| | |
| | | // 登录用户信息 |
| | | userInfo: null, |
| | | tableHeightNew: 300, |
| | | sysConfig: { title: '', subtitle: '' }, |
| | | primaryColor: '#2080f7', |
| | | // 首页 |
| | | homePage: null, |
| | |
| | | |
| | | const mutations = { |
| | | // 设置顶部菜单索引 |
| | | setCurrentIndex(state, index) { |
| | | setCurrentIndex (state, index) { |
| | | console.log('设置顶部菜单索引', index) |
| | | state.currentIndex = index |
| | | }, |
| | | setSysconfig (state, config) { |
| | | state.sysConfig = { title: config.title || '', subtitle: config.subtitle || '' } |
| | | document.title = state.sysConfig.title+ state.sysConfig.subtitle |
| | | }, |
| | | // 切换菜单状态 |
| | | switchCollapseMenu (state, value) { |
| | |
| | | }, |
| | | // 设置首页路由信息 |
| | | setTopMenuCurrent (state, current) { |
| | | console.log("setTopMenuCurrent",current) |
| | | if(current.id !== state.topMenuCurrent.id){ |
| | | console.log('setTopMenuCurrent', current) |
| | | if (current.id !== state.topMenuCurrent.id) { |
| | | state.topMenuList.list.forEach(item => { |
| | | console.log(item.id, item.id) |
| | | if (current.id == item.id) { |
| | |
| | | }, |
| | | // 重置菜单 |
| | | resetMenus: (state) => { |
| | | state.topMenuId=null |
| | | state.topMenuId = null |
| | | state.menuData.list = [] |
| | | }, |
| | | // tags |
| | |
| | | // findindex找角标,循环判断一下,如果等于那么就代表有相同的,就不必添加,如果找不到那就是-1.就添加 |
| | | // state.tags = [{ ...val, keepAlive: false }] |
| | | const result = state.tags.findIndex(item => item.index === val.index) |
| | | if (result === -1) { |
| | | if (result === -1) { |
| | | state.tags.push({ ...val, keepAlive: false }) |
| | | } else { |
| | | state.tags[result] = { ...val, keepAlive: false } |