美文网首页
fetch-jsonp 的使用

fetch-jsonp 的使用

作者: 白小纯Zzz | 来源:发表于2019-05-28 21:17 被阅读0次
fetch-jsonp  不受跨域限制

安装  cnpm i fetch-jsonp -S

用法 : 在项目中引入
import  fetchJsonp  from  fetch-jsonp

fetchJsonp("请求的url地址")
.then(response => res.json() )
.then(data => console.log(data))
  //注意: 第一个.then 中获取到的不是最终数据,而是一个中间的数据流对象;
  // 注意: 第一个  .then 中获取到的数据, 是一个 Response 类型对象;
  // 注意: 第二个 .then 中,获取到的才是真正的 数据;

相关文章

网友评论

      本文标题:fetch-jsonp 的使用

      本文链接:https://www.haomeiwen.com/subject/mqijtctx.html