由於某些原因,fetch
(https://fetch.spec.whatwg.org/)未在Safari(版本9.0.3)中定義,有誰知道爲什麼?它似乎是標準,並在Chrome和Firefox中正常運行。似乎無法找到任何人有同樣的問題fetch未在Safari中定義(ReferenceError:找不到變量:獲取)
我使用與Redux的反應,這裏是一些示例代碼:
export function fetchData (url) {
return dispatch => {
dispatch(loading())
fetch(url, {
method: 'GET'
})
.then(response => {
response.json()
.then(data => {
dispatch(success(data))
})
})
}
}
http://caniuse.com/#search=fetch'fetch'沒有Safari支援。 –