this.$http.post()跨域和请求参数丢失
methods: { 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( function (res) { console.log(res); this.msg = res.bodyText; }, function (res) { console.log(res.status); } ); } } this.http.post()参数需注意
第一个参数是url,第二个参数是body,body为object,如果body为空的时候,参数填{};
this.http.post('url' + id, {}) .subscribe(res => { }, error => { }) 热门文章
- 全国宠物领养平台可信吗现在(全国宠物领养中心官网)
- 3月3日20M/S|Clash/Shadowrocket/SSR/V2ray免费节点每天更新订阅链接,代理机场推荐
- 3月11日19.8M/S|V2ray/Shadowrocket/SSR/Clash免费节点每天更新订阅链接,代理机场推荐
- 网络协议之:socket协议详解之Datagram Socket
- 中牧兽用疫苗厂家电话(中牧股份动物疫苗)
- Pandas 如何处理超大规模数据
- 2月12日19.8M/S|V2ray/Shadowrocket/SSR/Clash免费节点每天更新订阅链接,代理机场推荐
- 动物医院工作时间(动物医院工作时间安排)
- 1月10日18M/S|Shadowrocket/Clash/SSR/V2ray免费节点每天更新订阅链接,代理机场推荐
- @Valid 参数校验不生效问题解决