import Vue from 'vue'; import Vuex from 'vuex'; import _ from 'lodash'; import axios from 'axios'; Vue.use(Vuex); const api = { calendar: `/api/train/common/findyear`, }; const state = () => ({}); const mutations = {}; const actions = { async calendar({ commit }, { year } = {}) { const res = await this.$axios.$get(`${api.calendar}`, { year }); if (res.errcode == '0') return res.data; else this.$message.error(res.reason || '万年历接口请求失败'); }, }; export default { namespaced: true, state, mutations, actions, };