//异步转同步
async function test(){
try{
var a = false
await getTableInfo().then((res)=>{
//请求接口后的操作
a = true
})
}catch(e){
return;
}
return a
}
//调用函数
test().then((res)=>{
console.log(res,'获取test函数返回值')
})
异步函数转同步函数
最新推荐文章于 2023-12-08 13:23:43 发布