javascript - 关于ES7 fetch 获取数据问题
typecho
typecho 2017-06-26 10:50:50
0
3
756
fetch('/static/data/data.json')
            .then(data => {
                console.log(data);
            })

但是 也没有给我返回数据啊, 数据在哪里?

typecho
typecho

Following the voice in heart.

全部回复(3)
迷茫

首先 Fetch API 是一个 Web API,跟 ES7 没什么关系。

关于 Fetch API,需要配合 Request 和 Response 两个,关于这些 API 如何配合完成请求,这里有比较详细的教程。

女神的闺蜜爱上我

参见MDN:
https://developer.mozilla.org...进行_fetch_请求
应该使用:

data.blob()
学霸

fetch('/static/data/data.json')

雷雷
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板