}).then(function (response) {
return response.json();
}).then(function (response) {
_this.error = false;
_this.page++;
请问下这里的两个then分别表示什么意思,为啥不放在同一个then里面呢?
}).then(function (response) {
return response.json();
}).then(function (response) {
_this.error = false;
_this.page++;
请问下这里的两个then分别表示什么意思,为啥不放在同一个then里面呢?
13 回答12.8k 阅读
7 回答1.9k 阅读
9 回答1.7k 阅读✓ 已解决
6 回答942 阅读
3 回答1.1k 阅读✓ 已解决
3 回答1.3k 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
第一个then是将返回值json化
第二个then是通过返回值完成具体业务
个人觉得这么做的可能是因为逻辑分离,类似于函数组合使用一样,每个函数的输入输出是固定的,也方便于后期修改。