[Vuejs]-Vuex – How to use function from mapAction within local computed method

1👍

state & getters can be merged as computed properties

actions & mutations can be merged as methods

then u should use his maps as below:

computed: {
  ...mapGetters([
    'returnShop',
    'returnPlan',
    'returnFulfillmentEnabled'
  ]),
  selectPlan: {
    get() {
      this.returnPlan;
    },
    set(value) {
      this.updatePlan(value);
    }
  }
},

methods: {
  ...mapActions([
    'getShop',
    'updatePlan'
  ])
}

Leave a comment