hejianhao
2025-03-31 8790f99a94733c7c3836706c75a77f9bbb15c2ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
 
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);
    }
  }
})
 
export default store