[Vuejs]-How to handle Array of objects in Vuex, WHen we have Complex form structure

0👍

you could utilize lodash#set

// component
this.$store.commit('MUTATE_FORMDATA_CONTACTS', {
  path: 'account[0].personal[0].contacts[0]',
  value: data 
})

// while utilizing lodash#set in the store
// import {set} from 'lodash-es'

[MutationTypes.MUTATE_FORMDATA_CONTACTS](state, payload) {
  set(state.form,payload.path,payload.data);
},

Leave a comment