[Vuejs]-How to retrieve data from a specific getters in vue?

1👍

Step 1: Set the getter in the store.

getters: {
     clientList: state => {
          return state.clientList
     }
}

Step 2: Call the getter in your component as computed

computed: {
   clientList () {
          return this.$store.getters.clientList
     }
}

Check your syntax. The getter you posted won’t work because you’re missing the module-specific syntax.

As an example from the following link:
this.$store.getters['ModuleA/getCategory'](this.index)

See more here: Vue.js 2/Vuex – How to call getters from modules that has attribute namespaced:true without mapGetters?

👤Arc

Leave a comment