[Vuejs]-How to use state in data function in vue

0👍

If the state is updating correctly, the time taking for setting the state is making the issue. That means, the the function you’re using to assign the state to data is rendering before the state set.

You can use a computed function that returning the state

computed:{
  items : function(){
    return this.$store.state.search_items;
  }
}

Now you can use the computed function name items same like a data variable.

Leave a comment