You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
618 B
36 lines
618 B
import Vue from "vue";
|
|
import Vuex from "vuex";
|
|
|
|
import storeAuth from "./modules/auth";
|
|
|
|
Vue.use(Vuex);
|
|
|
|
const store = new Vuex.Store({
|
|
state: {
|
|
stations: [],
|
|
},
|
|
mutations: {
|
|
SET_STATIONS(state, stations) {
|
|
state.stations = stations || [];
|
|
},
|
|
},
|
|
actions: {
|
|
/**
|
|
* [{ id: 1, name: "长沙南站" }]
|
|
*/
|
|
updateStations({ commit }, stations) {
|
|
commit(
|
|
"SET_STATIONS",
|
|
stations.sort((a, b) =>
|
|
a.pinyin < b.pinyin ? -1 : a.pinyin > b.pinyin ? 1 : 0
|
|
)
|
|
);
|
|
},
|
|
},
|
|
modules: {
|
|
auth: storeAuth,
|
|
},
|
|
});
|
|
|
|
export default store;
|