javascript - How to request real data from the background when using vue-cli for projects?
世界只因有你
世界只因有你 2017-05-19 10:36:41
0
5
710

How to request real data from the background when using vue-cli for projects?

世界只因有你
世界只因有你

reply all(5)
小葫芦

Didn’t the backend open an interface for you?

PHPzhong

You can use vue-resource

//get || post
this.$http.get(url).then((res) => {
    // do something
}, (res) => {
    // error callback
})
phpcn_u1582

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');
Peter_Zhu

axios,jquery

大家讲道理

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template