时间:2020-12-01 11:51:22 | 栏目:vue | 点击:次
组件内取值
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":{} } }