之間有什么區別?new Promise(function(res, rej) { res("aaa"); }) .then(function(result) { return "bbb"; }) .then(function(result) { console.log(result); });還有這個:new Promise(function(res, rej) { res("aaa"); }) .then(function(result) { return Promise.resolve("bbb"); }) .then(function(result) { console.log(result); });我問的是我正在使用Angular和$ http服務以及鏈接.then()時出現不同的行為。因此,代碼太多了,因此首先是上面的示例。
從then()返回值或Promise.resolve有什么區別
楊魅力
2020-02-03 15:01:18