复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17methods: { research: function () { //post请求远程资源 this.$http.post( //请求的url "http://www.hefeixyh.com/login.html", //请求参数,不能以get请求方式写:{params: {userName: "root123", passWord: "root123"}} {userName: "root123", passWord: "root123"}, //解决跨域问题,不加无法跨域 {emulateJSON: true} ).then(result=>{ console.dir(result) }).catch(error=>{ console.dir(error) }); } }
最后
以上就是平常绿茶最近收集整理的关于vue中this.$http.post()跨域和请求参数丢失解决方案的全部内容,更多相关vue中this内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复