如下这个自定函数,如何return数据库的数据?

发布于 8 年前作者 whuang12527 次浏览最后编辑 8 年前来自 ask
function getList( cid )
{
  products.where({ cid:cid }).get().then( res=>{
    console.log( res.data )
  } )
}

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

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