[Vuejs]-Vuex state is readonly

1👍

You can create mutation in your vuex store

 mutateActive: (state, val) => (state.renameActive = val),

and vuex action that you will call:

 setActive({ commit }, val) {
   commit('mutateActive', val);
 },

and in your method call vuex action and pass the value:

addTab() {
   this.$store.dispatch('setActive', true)
}

Leave a comment