组件内取值
computed: {
value() {
return this.$store.state.userData.xxx;
}
},
组件内存值
methods: {
fn() {
this.$store.commit('setValue',xxx)
}
}
store的matution.js中
setValue(state,xxx){
state.userData.xxx= xxx;
},
store的index.js中
const state = {
userData: {
"xxx":{}
}
}