import Vue from "vue"; import Vuex from "vuex"; // import createPersistedState from "vuex-persistedstate"; // import SecureLS from "secure-ls"; // var ls = new SecureLS({ isCompression: false }); Vue.use(Vuex); export default new Vuex.Store({ state: { devicenum: "", // 设备编号 homeInfo: {}, // 首页数据 datumList: [], // 首页材料 matterList: [], // 首页事项 deviceCode: "", // 设备编码 times: 300, // 倒计时时间 defaultTimes: 300, // 倒计时时间 operTime: "", // 样表打开时间 }, getters: { deviceCode(state) { return state.deviceCode; }, times(state) { return state.times; }, defaultTimes(state) { return state.defaultTimes; }, operTime(state) { return state.operTime; }, }, mutations: { SET_operTime(state, operTime) { state.operTime = operTime; }, SET_devicenum(state, devicenum) { state.devicenum = devicenum; }, SET_homeInfo(state, homeInfo) { state.homeInfo = homeInfo; }, SET_datumList(state, datumList) { state.datumList = datumList; }, SET_matterList(state, matterList) { state.matterList = matterList; }, SET_deviceCode(state, deviceCode) { state.deviceCode = deviceCode; }, SET_times(state, times) { state.times = times; }, }, actions: {}, modules: {}, // 持久化插件 // plugins: [ // // createPersistedState({ // // storage: window.sessionStorage, // // }), // createPersistedState({ // key: "info", // storage: { // getItem: (key) => ls.get(key), // setItem: (key, value) => ls.set(key, value), // removeItem: (key) => ls.remove(key), // }, // }), // ], });