zhangwei
2024-09-11 4eef04aa662cf4f8fbde60ca99c0011b6203c558
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import {
    createStore
} from 'vuex'
 
const store = createStore({
    // 为了不和页面或组件的data中的造成混淆,state中的变量前面建议加上$符号
    state: {
        userInfo: {}, //用户信息存储
    },
    mutations: {
        userInfo(state, userInfo) {
            state.userInfo = userInfo
        },
    },
    actions: {
    },
    getters: {
        userInfo: state => state.userInfo,
    }
})
 
export default store