在双重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()
},

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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM