1 回答
TA贡献1993条经验 获得超5个赞
你想做什么不是很清楚。
但是当你这样做的时候
axios.get(
this.host +
this.domain +
`/site/` + ids[0] + `/overview?` +
this.apiKey,
this.config
)
您需要为每个 id 权利运行此查询。您的方法应该更像这样:
methods: {
async getSiteDetails() {
let ids = [];
await axios.get(
this.host +
this.domain +
"/sites/list?sortProperty=name&sortOrder=ASC&" +
this.apiKey,
this.config
)
.then((...responses) => {
this.siteList = responses[0].data;
ids = this.siteIdList.concat(responses[0].data.sites.site).map(x => x.id);
})
ids.forEach(this.getOverviewList);
},
async getOverviewList(id) {
axios.get(
this.host +
this.domain +
`/site/` + id + `/overview?` +
this.apiKey,
this.config
)
.then(((...responses) => {
this.overviewList[id] = responses[0].data;
}))
.catch(errors => {
console.log(errors);
});
},
}
添加回答
举报