为什么总是报错,fetch is not a function?

发布于 7 年前作者 qdai13119 次浏览最后编辑 7 年前来自 ask

const url = ‘https://api.douban.com/v2/movie/in\_theaters’ 

fetch(url).then(function(response) {

     return  response.json();

     }).then(function (data) {

        that.setData({

          filmlist: data.subjects

        })

      })

    哪里错了呀?

fetch使用有什么需要注意的吗?

5 回复
ping51
ping511 楼6 年前

东西两个字也会屏蔽?

xiulan68
xiulan682 楼6 年前

应该是“有些东西”

slin
slin3 楼6 年前

小程序提供了发出请求的 API。

taomin
taomin4 楼6 年前

fetch(url, {

   credentials: ‘include’,

            headers: {

                ‘Accept’: ‘application/json, text/plain, */*’

            },

        });

xiuyingshen
xiuyingshen5 楼5 年前

就是有些。。用不了,最简单的例子 alert()