Vue jsonp定义跨域的报头

来源:互联网 发布:ff14 npc捏脸数据库 编辑:程序博客网 时间:2024/06/06 18:54

Vue jsonp定义跨域的报头(在headers中定义)


mounted: function() {

        this.$http.jsonp('https://api.douban.com/v2/movie/top200?count=5',{},{

        headers: {

        Access-Control-Allow-Origin: *

                },

               emulateJSON: true

   }).then(function(response) {

              // 这里是处理正确的回调

     this.articles = response.data.subjects


           }, function(response) {

       // 这里是处理错误的回调

             console.log(response)

          });

}


原创粉丝点击