Files
klp-oa/klp-ui/src/store/modules/category.js

30 lines
547 B
JavaScript
Raw Normal View History

2025-07-19 17:29:15 +08:00
import { listCategory } from '@/api/wms/category';
const state = {
categoryList: []
};
const mutations = {
SET_CATEGORY_LIST(state, list) {
state.categoryList = list;
}
};
const actions = {
getCategoryList({ state, commit }) {
if (state.categoryList.length > 0) {
return Promise.resolve(state.categoryList);
}
return listCategory().then(res => {
commit('SET_CATEGORY_LIST', res.rows || []);
return res.rows || [];
});
}
};
export default {
namespaced: true,
state,
mutations,
actions
};