Promise then then没有产生依赖关系效果?

像下面这样写两个互相依赖的ajax操作,refreshStatus函数内部没有拿到getDesktopList的返回结果:

  var promise = Promise.resolve()
  promise
    .then(this.getDesktopList())
    .then(this.refreshStatus())
    .catch(function() {})
阅读 2.6k
3 个回答

this.getDesktopList()也要返回promise对象哦。

then 处理后要将 promise return 出来才能下一步继续 then

新手上路,请多包涵

this.getDesktopList()这个方法也要return 噢 不然不是promise对象不能继续then下去

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进