react中使用fetchjsonp获取数据

Posted on 2019-07-20 19:01  猫头唔食鱼  阅读(1353)  评论(0编辑  收藏  举报

fetchjsonp只能发送get请求

  componentDidMount(){
    fetchjsonp("http://jsonplaceholder.typicode.com/posts/1").then(res=>{
     return res.json()
      
    }).then(result=>{
      console.log(result);
      
    }).catch(err=>{
      console.log(err);
      
    })
  }