In vue 2.0, in the environment built with vue webpack vue-resource, when running this.$http.post() locally... does it report an error?
欢迎选择我的课程,让我们一起见证您的进步~~
You are reporting a cross-domain error. Please check if there is any problem with the interface first!
It’s cross-domain, big brother.
Solution 1: Backend engineers are required to cooperate in setting Access-Control-Allow-Origin to *
一定要设置 {emulateJSON: true},不然跨域不成功. 如果Web服务器无法处理编码为application/json的请求,你可以启用emulateJSON选项。启用该选项后,请求会以application/x-www-form-urlencoded作为MIME type,就像普通的HTML表单一样
Solution 2: this.$http.jsonp('...', { credentials: true }) Use JSONP
You are reporting a cross-domain error. Please check if there is any problem with the interface first!
It’s cross-domain, big brother.
Solution 1: Backend engineers are required to cooperate in setting Access-Control-Allow-Origin to *
Solution 2: this.$http.jsonp('...', { credentials: true }) Use JSONP
Off topic: It is recommended to use axios vue-resource to officially stop maintenance in the future. It is almost the same in use