我有一个对象,当我'm printing that it'返回 Promise <Pending>
(我已经检查了 getRateable
的类型,它是对象)
getRateable = getRateableEntitiesTx(tx, hashtagList);
我无法通过此访问该值:
getRateableEntitiesTx(tx, hashtagList).then((res) => {return res})
如果它是 Promise
为什么它没有正确返回 res
?
在此先感谢您的帮助
1 回答
你可以't return the value from an async function because the function returns before the value has been received. That'为什么我们有承诺 . 您需要使用
then()
回调中的值: