首页 > vue-resource的get请求问题

vue-resource的get请求问题

是跨域请求,看了文档的写的是jsonp('url',[data]),这里的data我写错了么?

this.$http.jsonp( 'http://rap.taobao.org/mockjs/3733/api/v1/rest?action=delete&pageID=&personnelID=',{pageID:29})
                        .then(response => {
                         console.log($index)
                        console.log(response.data)
            }).catch((err) => {
                    console.log(err)
            })

如果在请求的url后面pageID=21,就能返回结果,写data传递参数就没返回,为什么呢


http://rap.taobao.org/mockjs/3733/api/v1/rest?action=delete&pageID=&personnelID=

这里不需要填写参数key的,直接http://rap.taobao.org/mockjs/3733/api/v1/rest就行


这么写呢?:

this.$http
    .jsonp( 'http://rap.taobao.org/mockjs/3733/api/v1/rest?action=delete&pageID=&personnelID=',{params: { pageID:29 }})
    .then(response => {
        console.log($index)
        console.log(response.data)
     })
     .catch((err) => {
        console.log(err)
     });
【热门文章】
【热门文章】