in vue, there are two vue component files using vuex,
the first vue component sets searchPoint: {} in state, one of which is count
this data is needed in the second vue component, which is written in computed
computed:{
search_points_count(){
console.log(this.$store.state);
return this.$store.state.searchPoint.count;
}
},
listen to this data:
watch:{
search_points_count(val){
console.log(val)
}
},
after running in the browser, the console will output state
countreturnconsole.log(this.$store.state);console.log(this.$store.state.searchPoint.count);
undefined
statesearchPoint:{count:0}
which god can help me solve this problem for a moment? I"m so worried ~
how do I get and monitor this value?