12345678910111213141516171819202122232425262728293031 |
- import Cache from '@/utils/cache'
- import Constant from '@/utils/constant'
- const val = Cache.get(Constant.CACHE_TAB_SELECTED)
- const getDefaultState = () => {
- return {
- index: val === undefined ? 1 : val
- }
- }
- const state = getDefaultState()
- const mutations = {
- SET_INDEX: (state, index) => {
- Cache.set(Constant.CACHE_TAB_SELECTED, index)
- state.index = index
- }
- }
- const actions = {
- index({ commit }, index) {
- commit('SET_INDEX', index)
- }
- }
- export default {
- namespaced: true,
- state,
- mutations,
- actions
- }
|