TraceabilityAPP/store/index.js

46 lines
674 B
JavaScript
Raw Normal View History

2023-11-27 18:23:17 +08:00
import {
createStore
} from 'vuex'
const store = createStore({
2023-12-25 00:26:32 +08:00
state: {
userInfo: uni.getStorageSync("SY_USER") || null,
2024-01-04 19:29:00 +08:00
tabbrIndex: 0,
onScoket: false,
2023-12-25 00:26:32 +08:00
2023-11-27 18:23:17 +08:00
},
mutations: {
saveUserInfo(state, info) {
state.userInfo = info
2023-12-25 00:26:32 +08:00
uni.setStorageSync("SY_USER", info)
},
changeTabbar(state, index) {
state.tabbrIndex = index
2024-01-04 19:29:00 +08:00
},
changeScoket(state, index) {
state.onScoket = true
2023-11-27 18:23:17 +08:00
}
},
actions: {
2023-12-25 00:26:32 +08:00
saveUserInfo({
commit
}, info) {
2023-11-27 18:23:17 +08:00
commit('saveUserInfo', info)
2023-12-25 00:26:32 +08:00
},
changeTabbar({
commit
}, info) {
commit('changeTabbar', info)
2024-01-04 19:29:00 +08:00
},
changeScoket({
commit
}, info) {
commit('changeScoket')
2023-11-27 18:23:17 +08:00
}
}
})
export default store