有用
return this.http.post(url, data, {observe: 'response'})
但由于某種原因它沒有
let options = {
headers: new HttpHeaders().set('Content-Type', "application/json"),
withCredentials: true,
observe: 'response'
}
return this.http.post(url, data, options)
為什么以及如何在這種情況下使用觀察:“回應”?
uj5u.com熱心網友回復:
你應該確切地說出什么不起作用。我猜打字稿編譯器在抱怨這種型別。
你可以像這樣解決這個問題:return this.http.post(url, data, options as any)
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/463725.html
標籤:javascript 有角度的 打字稿 http
下一篇:Vue3重復識別符號ref
