}).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里面呢?
10 回答11.1k 阅读
6 回答3k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.6k 阅读✓ 已解决
2 回答4.7k 阅读✓ 已解决
4 回答4.3k 阅读✓ 已解决
第一个then是将返回值json化
第二个then是通过返回值完成具体业务
个人觉得这么做的可能是因为逻辑分离,类似于函数组合使用一样,每个函数的输入输出是固定的,也方便于后期修改。