解决代码不按顺序执行

function dataTransFun() {
	return new Promise((resolve, reject) => {
		let promises = state.listedInfo.map((info: any) => {
			return getApplyForCodePara({ productId: info.productId }).then((res: any) => {
				if (res.data && res.status == '1000') {
					console.log('代码....')

				}
			});
		});
		Promise.all(promises)
			.then(() => {
				resolve(true);
			})
			.catch(error => {
				reject(error);
			});
	});
}
async function saveData() {
	await dataTransFun();
	console.log('其他执行代码')
}

你可能感兴趣的:(javascript,前端,vue.js)