嵌套调用接口函数来获取并更改信息,但是第二个接口函数取不到循环的i值,尝试传参,但是then方法又不太了解
fetchUserList(this.listQuery).then(response => {
this.list = response.data.list
for(var i=0;i < this.list.length;i++){
this.list[i] = Object.assign({},this.list[i],this.list[i].sysUser)
// this.list[i].office = getOfficeInfoById(this.list[i].officeId)
getOfficeInfoById(this.list[i].officeId).then(response =>{
this.office = response.data.data.name
console.log(i)
})
}
console.log(this.list)
this.total = response.data.total
this.listLoading = false
})
慕容3067478
相关分类