How to request real data from the background when using vue-cli for projects?
PHPz2017-05-19 10:38:41
You can use vue-resource
//get || post
this.$http.get(url).then((res) => {
// do something
}, (res) => {
// error callback
})
phpcn_u15822017-05-19 10:38:41
You can use vue-resource to make requests
Maybe the poster is encountering a cross-domain problem?
If the background is php, please add it to the receiving method
header('Access-Control-Allow-Credentials:true');
header("Access-Control-Allow-Origin:*");
header('Access-Control-Allow-Headers:x-requested-with,content-type');
大家讲道理2017-05-19 10:38:41
What the original poster means is how to request back-end data, not that there is no interface. Just configure a proxy. There is no need to cross domain. Just configure a proxyTable in index.js under config.