Cannot get the value in state in the vue component

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

clipboard.png

countreturnconsole.log(this.$store.state);console.log(this.$store.state.searchPoint.count);
undefined
statesearchPoint:{count:0}

clipboard.png

which god can help me solve this problem for a moment? I"m so worried ~

how do I get and monitor this value?

Mar.21,2021

how does your state in vuex define an initial value
if your state = {searchPoint: {},.}
sets count using state.searchPoint.count = *
vue is not listening for count changes
you need to initialize state = {searchPoint: {count:'},.}
or change the direction of searchPoint when you go to count.
such as state.searchPoint= {count: * *,.}
or state.searchPoint=Object.assign ({}, state.searchPoint, {count: * })

Menu