//异步转同步
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函数返回值')
})
异步函数转同步函数
最新推荐文章于 2024-06-16 18:09:06 发布