vue-resource - vue resource发送post请求问题

查看:101
本文介绍了vue-resource - vue resource发送post请求问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

 this.$http.jsonp({
                url: 'http://www.xxx.com/index.php/Home/Login/loginProcess',
                method: 'POST',
                emulateJSON: true,
                data: {
                    robot:123,
                    phone:"13881119614",
                    password:"menji111",
                    usertype:0
                }
            }).then(function(response) {

                console.log(response.data);

            }, function(response) {

            });

跨域

已经是jsonp了啊

XMLHttpRequest cannot load http://www.cxxx.com/index.php/Home/Login/loginProcess. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.

解决方案

vue-resource 的jsonp只支持get,不支持post,如果要使用post,应该用this.$http.post

这篇关于vue-resource - vue resource发送post请求问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆