鍍金池/ 問答/HTML/ Promise then then沒有產(chǎn)生依賴關(guān)系效果?

Promise then then沒有產(chǎn)生依賴關(guān)系效果?

像下面這樣寫兩個(gè)互相依賴的ajax操作,refreshStatus函數(shù)內(nèi)部沒有拿到getDesktopList的返回結(jié)果:

  var promise = Promise.resolve()
  promise
    .then(this.getDesktopList())
    .then(this.refreshStatus())
    .catch(function() {})
回答
編輯回答
風(fēng)畔

then 處理后要將 promise return 出來才能下一步繼續(xù) then

2018年3月23日 12:41
編輯回答
拼未來

this.getDesktopList()也要返回promise對(duì)象哦。

2018年7月26日 08:51
編輯回答
護(hù)她命

this.getDesktopList()這個(gè)方法也要return 噢 不然不是promise對(duì)象不能繼續(xù)then下去

2017年7月18日 16:45