如下这个自定函数,如何return数据库的数据?
发布于 6 年前 作者 whuang 12402 次浏览 来自 问答
function getList( cid )
{
  products.where({ cid:cid }).get().then( res=>{
    console.log( res.data )
  } )
}

这个自定义函数所获得的 res.data。 该如何return
1 回复
return 不出去的

async function getList( cid )
{
  const res = await products.where({ cid:cid }).get()
  console.log(res.data)
}
回到顶部