hejianhao
2025-03-31 8790f99a94733c7c3836706c75a77f9bbb15c2ca
src/store/index.js
@@ -5,15 +5,36 @@
const store = new Vuex.Store({
  state: {
    menus: localStorage.getItem('menuList') ? JSON.parse(localStorage.getItem('menuList')) : [],
    keepAliveList: [],//缓存页面
    tagList: [],//标签列表
    isFold: false,//是否折叠
  },
  mutations: {
    SET_MENUS(state, data) {
      state.menus = data;
    },
    SET_KEEPALIVELIST(state, data) {
      state.keepAliveList = data;
    },
    SET_TAGLIST(state, data) {
      state.tagList = data;
    },
    SET_ISFOLD(state, data) {
      state.isFold = data;
    },
  },
  actions: {
    setMenus({ commit }, data) {
      commit('SET_MENUS', data);
    },
    setKeepAliveList({ commit }, data) {
      commit('SET_KEEPALIVELIST', data);
    },
    setTagList({ commit }, data) {
      commit('SET_TAGLIST', data);
    },
    setIsFold({ commit }, data) {
      commit('SET_ISFOLD', data);
    }
  }
})