vue-resource jsonp带headers报错401如何解决

          callme :function(){
            var headers = {}
            headers.Authorization = 'Bearer ' + localStorage.getItem('token')
            this.$http.jsonp('http://abc.edf.cn/api/home',{headers:headers})
                 .then(function (response) {
                  //登录
              }, function (response) {
                //错误
              });
          }

报错401,这样写有问题吗?
在postman通过的

图片描述

阅读 6.3k
1 个回答
新手上路,请多包涵

A JSONP request works by creating a <script> element with its src attribute set to the request URL.
You cannot add custom headers to the HTTP request sent by a <script> element.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题