doum
2 天以前 fe29cab3d9bf8ddfeb1bc93a25a79c20276d8171
admin/src/store/index.js
@@ -7,6 +7,7 @@
  // 登录用户信息
  userInfo: null,
  tableHeightNew: 300,
  sysConfig: { title: '', subtitle: '' },
  primaryColor: '#2080f7',
  // 首页
  homePage: null,
@@ -35,9 +36,13 @@
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) {
@@ -68,8 +73,8 @@
  },
  // 设置首页路由信息
  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) {
@@ -81,7 +86,7 @@
  },
  // 重置菜单
  resetMenus: (state) => {
    state.topMenuId=null
    state.topMenuId = null
    state.menuData.list = []
  },
  //  tags
@@ -90,7 +95,7 @@
    // 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 }