railWay.js 665 Bytes
Newer Older
neogcg's avatar
neogcg committed
1 2
import { railWaylist } from "../../views/setting/api"
const state = {
neogcg's avatar
neogcg committed
3 4 5
    list: [],
    pageNum:1,
    pageSize:10,
neogcg's avatar
neogcg committed
6 7 8 9 10 11 12 13
}
const mutations = {
    changeList(state, arr) {
        state.list = arr
    }
}
const actions = {
    asyncList(context) {
neogcg's avatar
neogcg committed
14 15 16 17
        railWaylist( {
            current: context.state.pageNum,
            size: context.state.pageSize,
          }).then(res => {
neogcg's avatar
neogcg committed
18
        
neogcg's avatar
neogcg committed
19 20
        let arr = res.records?res.records:[]
 
neogcg's avatar
neogcg committed
21 22 23
            context.commit("changeList", arr)
        })
    }
neogcg's avatar
neogcg committed
24
   
neogcg's avatar
neogcg committed
25 26 27 28 29 30 31 32 33 34 35 36 37
}
const getters = {
    list(state) {
        return state.list
    }
}
export default {
    state,
    mutations,
    actions,
    getters,
    namespaced: true
}