0👍
Mutations should be immutable to make data reactive
mutations: {
ADD_OFFICE: (state, offices) => {
state.all = state.all.concat(offices)
},
DELETE_OFFICE: (state, id) => {
state.all = state.all.filter(office => office.id != id)
},
UPDATE_OFFICE: (state, data) => {
const officeIndex = state.all.findIndex(office => office.id === data.id)
const newObj = Object.assign(state.all[officeIndex], data)
state.all = [
...state.all.slice(0, officeIndex),
newObj,
...state.all.slice(officeIndex + 1)
]
}
},
- [Vuejs]-NativeScript + Vue : let User to Select Color Scheme
- [Vuejs]-For each results in v-for loop how can I nest another v-for loop using a parameter from the results of the first loop
Source:stackexchange.com