0👍
Because the new property of eachCategoryItems
is not reactive, so you need the Vue set
if(!state.eachCategoryItems[item.CATEGORY])
Vue.set(state.eachCategoryItems, item.CATEGORY, [item]);
else
state.eachCategoryItems[item.CATEGORY].push(item);
- [Vuejs]-For-in cicle gives back only last result in array.push
- [Vuejs]-Vue.js Dynamically extend/replace child component method at runtime with access to parent scope
Source:stackexchange.com