TraceabilityAPP/store/index.js

36 lines
521 B
JavaScript

import {
createStore
} from 'vuex'
const store = createStore({
state: {
userInfo: uni.getStorageSync("SY_USER") || null,
tabbrIndex: 0
},
mutations: {
saveUserInfo(state, info) {
state.userInfo = info
uni.setStorageSync("SY_USER", info)
},
changeTabbar(state, index) {
state.tabbrIndex = index
}
},
actions: {
saveUserInfo({
commit
}, info) {
commit('saveUserInfo', info)
},
changeTabbar({
commit
}, info) {
commit('changeTabbar', info)
}
}
})
export default store