methods: {
const handleClick = async (row, val) => {
const data = {
id: row.id,
time: 'now'
}
let res1 = await get1Fun(data)
let res2 = await get2Fun(data)
console.log(res1, res2)
console.log(res1, res2)
console.log(res1, res2)
console.log(res1, res2)
.....................
},
//获取1
const get1Fun= async (data) => {
return await new Promise((resolve) => {
get1(data).then((res) => {
resolve(res)
})
})
}
//获取2
const get2Fun= async (data) => {
return await new Promise((resolve) => {
get2(data).then((res) => {
resolve(res)
})
})
}
}
es6 - async await应用
于 2021-09-25 20:04:33 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)