store.js 425 B

12345678910111213141516171819202122232425
  1. import { waitTaskListCount } from "./api";
  2. const state = {
  3. waitTaskCount: 0
  4. };
  5. const mutations = {
  6. setNotDoneTaskCount(state, waitTaskCount) {
  7. state.waitTaskCount = waitTaskCount;
  8. }
  9. };
  10. const actions = {
  11. async updateWaitTaskCount({ commit }) {
  12. const count = await waitTaskListCount();
  13. commit("setNotDoneTaskCount", count);
  14. }
  15. };
  16. export default {
  17. namespaced: true,
  18. state,
  19. mutations,
  20. actions
  21. };