如题,因为我在组件create里面获取不到值,请问怎么才能获取更新后的vuex state值
this.$store.dispatch('setText','jj');
console.log(this.$store.state.text);//这里打印的是jj
const store = new Vuex.Store({
state:{
wxInfo:{},
text:'ss'
},
...
computed:{
...mapState([
'wxInfo',
'text'
])
},
created(){
console.log(this.text)//但是在组件这里打印的却是 ss
...
用watch观察, 或者用computed计算属性