【发布时间】:2019-04-09 16:40:58
【问题描述】:
我正在使用 Nuxtjs,我想获取一个处于我状态的 id,并使用它来对 API 进行新的调用。
我的carInfo 有一个我想用来调用 API 的 IdAddress。
我的商店:
export const state = () => ({
allCars: [],
carInfo: [],
carAddress: []
});
export const actions = {
async fetchAll({ commit }) {
let cars= await this.$axios.$get(
"apiaddress"
);
commit("setCars", cars);
},
async fetchcar({ commit }, id) {
let car= await this.$axios.$get(
"apiaddress"
);
commit("setcar", car);
},
async fetchAddress({ commit }, id) {
let address = await this.$axios.$get(
"apiaddress"
);
commit("setAddress", address);
}
};
【问题讨论】: