我正在使用 axios 來獲取 API,并且需要根據(jù)返回的數(shù)據(jù)包含一個條件:axios.get('https://api.url.endpoint).then(response => ())我將如何根據(jù)響應(yīng)做出條件語句(特別是檢查響應(yīng)的屬性是否返回 null)?謝謝你的幫助。將 if..else 語句與如下所示的響應(yīng)一起使用是行不通的。axios.get('https://api.url.endpoint).then(response => (if (response.data != null) { }))
如何在 Promise.prototype.then() 中包含條件
千萬里不及你
2021-06-18 09:01:25