0๐
// Here you say categories will be an array.
let categories = ref<BaseCategory[]>([]);
const getBaseCategories = async () => {
await store.getBaseCategories();
// here you treat categories as an object.
categories.value = store.categories;
// maybe this should be
categories = store.categories;
};
- [Vuejs]-How to fix unloaded images in "vue product zoomer" nuxt ssr
- [Vuejs]-Vue $emit event triggering but this.$root.$on does nothing
0๐
According to the async MutationAction === magic in your used module. You should tell your action to mutate which state like following code (mark1).
// ignore other codes .......
class BaseCategoryModule extends VuexModule {
categories: IBaseCategory[] = [];
// ========= mark1 =========
@MutationAction({ mutate: ['categories'] })
async getBaseCategories() {
const result = await api.get('/v1/basecombicategories');
const data = result.data as IBaseCategory[];
return {
categories: data,
};
}
}
export default getModule(BaseCategoryModule);
- [Vuejs]-How to correctly reorder array when using computed properties with SortableJS and Vue?
- [Vuejs]-Getting target element from method (without event)
0๐
Unbelievable โฆ maybe I drunk to much ๐ There was another *.vue file with old code. I removed the old code and everything works perfectly. Shame on me !
0๐
I was having problem with state, and I was need to declare object properties.
like this
I had to change this
state: () => ({
training: {},
}),
to this
state: () => ({
training: { id: '', name: '' },
}),
Source:stackexchange.com