24 lines
610 B
JavaScript
24 lines
610 B
JavaScript
import carService from '../../service/carService'
|
|
|
|
export default {
|
|
state: {
|
|
carList: []
|
|
},
|
|
mutations: {
|
|
SET_CARLIST (state, data) {
|
|
state.carList = data
|
|
}
|
|
},
|
|
actions: {
|
|
async getCarList({ commit }) {
|
|
let res = await (new carService()).getCarList();
|
|
console.log("actions getCarList ===: ", res)
|
|
commit("SET_CARLIST", res)
|
|
},
|
|
async addCar({ commit }, params) {
|
|
let res = await (new carService()).addCar(params);
|
|
console.log("actions addCar ===: ", res)
|
|
|
|
}
|
|
}
|
|
} |