由于某种原因fetch
(https://fetch.spec.whatwg.org/)未在 Safari(版本 9.0.3)中定义,有人知道为什么吗?它似乎是标准并且在 Chrome 和 Firefox 中运行良好。似乎找不到其他人有同样的问题
我正在使用 redux 的反应,这里是一些示例代码:
export function fetchData (url) {
return dispatch => {
dispatch(loading())
fetch(url, {
method: 'GET'
})
.then(response => {
response.json()
.then(data => {
dispatch(success(data))
})
})
}
}