12345678910111213141516171819202122232425262728 |
- import Vue from "vue";
- import Vuex from "vuex";
- import { queryAllWorkType } from "@/services/workload";
- Vue.use(Vuex);
- const store = new Vuex.Store({
- state: {
- typeList: [],
- allType: {},
- currentProject: {},
- },
- mutations: {
- setType(state, values) {
- state.typeList = values.typeList;
- state.allType = values.allType;
- },
- setCurrentProject(state, project) {
- state.currentProject = project;
- },
- },
- actions: {
- getType: async function ({ commit, state }, value) {
- if (state.typeList.length > 0) return;
- commit("setType", await queryAllWorkType());
- },
- },
- });
- export default store;
|