jiuyiUniapp/service/store/index.js

45 lines
622 B
JavaScript

import {
createStore
} from 'vuex'
export default createStore({
state: {
// 用户信息
userinfo: {},
},
mutations: {
// 获取内容
setState(state, option) {
// 键值
const key = option.key
// 包
const value = option.value
// 修改对应内容
state[key] = value
},
},
getters: {
getUserInfo(state) {
return state.userinfo
},
getTabbarMode(state) {
return state.tabbarMode
},
},
actions: {
updateUserInfo({
commit
}, payload) {
commit('setUserInfo', payload)
},
changeTabbarMode({
commit
}, mode) {
commit('setTabbarMode', mode)
},
}
})