vuex存值与取值
组件内取值computed: {value() {return this.$store.state.userData.xxx;}},组件内存值methods: {fn() {this.$store.commit('setValue',xxx)}...
·
组件内取值
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":{}
}
}
更多推荐
已为社区贡献6条内容
所有评论(0)