在双重for循环内部使用async异步请求axios中遇到的问题

在methods中的方法

async getPro () {
	let _this = this
	let newArr = []
	await axios.get(`api/v1/dailyProTbms`, {checkToken: true}).then(async function(res){
		if (res.success && res.data.length > 0) {
			let arr = res.data
			for (let i in arr) {
				arr[i]['centerComment'] = ''
				arr[i]['checked'] = true
				for (let j in arr[i].tbms) {
					const _id = arr[i].tbms[j]._id
					arr[i].tbms[j]['dailyInfo'] = await _this.getData(_id) // getData是另一个axios请求
				}
				if (+i === arr.length - 1) {
					_this.spinShowTop = false
				}
			}
			_this.projects = arr
		}
	})
	this.setTotalInfo()
},

 不知道为什么重点的地方上不了色了

原文地址:https://www.cnblogs.com/wgl0126/p/11187175.html