xlcs/atguigu-tuan/store/modules/categories.js
2023-09-22 15:41:37 +08:00

28 lines
597 B
JavaScript

const state = {
categories: []
};
const getters = {};
const mutations = {
updateCategoriesMutation(state, payload) {
state.categories = payload;
}
};
const actions = {
async getCategoriesAction({
commit
}) {
return new Promise(async reslove => {
let result = await this._vm.$u.api.getCategories()
commit('updateCategoriesMutation', result)
reslove();
})
}
};
export default {
namespaced: true,
state,
mutations,
actions,
getters,
};