vue循环请求同一个接口,等接口返回数据之后在进行下次循环
async 方法名() {for (let i = 0; i < this.mlList.length; i++) {for (let j = 0; j < this.mlList[i].child.length; j++) {const res = await postapplicationJson({id: this.$route.params.id,c
·
async 方法名() {
for (let i = 0; i < this.mlList.length; i++) {
for (let j = 0; j < this.mlList[i].child.length; j++) {
const res = await postapplicationJson(
{
id: this.$route.params.id,
catalogID: value,
parentID: this.mlList[i].id,
childID: this.mlList[i].child[j].id
},
'/goods/across/syncCatalogAndGoods'
)
if (res.code == 1001) {
this.loading = false
this.$set(this.mlList[i].child[j], 'msg', '克隆成功')
} else {
this.$set(this.mlList[i].child[j], 'msg', res.msg)
this.loading = false
}
}
}
更多推荐
已为社区贡献6条内容
所有评论(0)