Small make up I was just solved this problem, this time self-study also almost, small series will begin to do project, finally to solve the problem of routing and problems encountered.
My main solution is the routing problem, the recommended here is Axios, he can calculate a separate technology, node inside can use NG inside also can use, Vue inside more can use than Vue own Vue-rource, His best place, I think, of course, it's a good package. RESTful's requests are encapsulated and easy to use, and this time we will primarily cross domain issues.
The first thing I'm using is vue-cli is scaffolding, we need to configure his Cross-domain access request in Webpack inside the Config folder inside the index.js inside of the Dev Plus
Proxytable: {
'/api ': {
target: ' http://api.douban.com/v2 ',//Set the interface domain name and port number you call don't forget to add HTTP
changeorigin:true ,
pathrewrite: {
' ^/api ': '////
Here is understood to replace the address in target with '/api ',
/
//////////////////// With ' Http://40.00.100.100:3002/user/add ', directly write '/api/user/add ' can}}
,
Don't forget to reboot your entire project, that is, NPM run Dev restarts the entire project.
You can see that it's been transferred.