//异步转同步
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函数返回值')
})
//异步转同步
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函数返回值')
})