vm.$http.post('http://XXX/employee/GetEmployeeList',formData).then((response) => {
if(response.body.errmsg == 'sucess'){
_this.employees = response.body.data
console.log(_this.employees);
}
})
报错
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
vue-resource 只是提供http请求简便方法,跨域这种,要么接口支持跨域,要么接口支持jsonp,如果你只是用的vue2和vue-cli,仅仅只是本地开发下跨域不方便的话,不妨试试 config目录下的index.js里的proxyTable
http://www.jianshu.com/p/95b2...
如果不是我说的情况- -忽略我的回答= =||