Updating object in array with Vuex [duplicate]
问题 This question already has answers here : Update data using vuex (3 answers) Closed 2 years ago . How can I update an object inside an array with Vuex? I tried this, but it didn't work: const state = { categories: [] }; // mutations: [mutationType.UPDATE_CATEGORY] (state, id, category) { const record = state.categories.find(element => element.id === id); state.categories[record] = category; } // actions: updateCategory({commit}, id, category) { categoriesApi.updateCategory(id, category).then(