[Vuejs]-How can I modify a various pieces of my Vuex from within a reusable nested component?

0👍

You have to wrap your store props like this:

computed: {
  fullName: {
    // getter
    get: function () {
      return this.$store.state.myobj.name
    },
    // setter
    set: function (newValue) {
      this.$store.commit('setName', newValue)
    }
  }
}

to use like this:

<instance-header v-model="fullName" />

Leave a comment