0
我想用愛可信庫發送多個請求。因此,根據docs,我可以all
方法做到這一點。這是例子:爲什麼我需要在axios.all回調中使用傳播函數?
function getUserAccount() {
return axios.get('/user/12345');
}
function getUserPermissions() {
return axios.get('/user/12345/permissions');
}
axios.all([getUserAccount(), getUserPermissions()])
.then(axios.spread(function (acct, perms) {
// Both requests are now complete
}));
可是爲什麼我需要寫的
.then(axios.spread(function (acct, perms) {
// Both requests are now complete
}));
代替
.then(function (acct, perms) {
// Both requests are now complete
});
如果它也能正常工作?
所以,可以用我的AJAX請求發生什麼,如果我不使用'spread'? – JustLogin
我不是在愛可信的專家而言,而是一個數組是不是爭論我懷疑一個有效的輸入。 –
我不是在愛可信的專家而言,而是一個數組是不是一個說法我懷疑一個有效的輸入。 –