vue beginning of the entry

Then on a blog, you have created a vue project, enter the command cd to the project directory, type the command

cnpm install axios -S

Download axios, re-entering the config / directory, edit index.js, find the file in the proxyTable: {} This place, edited in such a way

proxyTable: {
 ' / fire ' : {
target:'http://localhost:8000',
changeOrigin:true,
Pthriawrite: {
'^/api':''
}
}
}

This is connected to the back-end configuration allows cross-domain, (corresponding to the example of my first springboot blog, where the 8000 back-end address

Next configuration main.js, is introduced to the global axios

var axios = Require ( ' axios ' )
Vue.prototype. $ Axios = axios

This code is placed import the following, and then you can refer to this. $ Axios direct anywhere.

About my understanding for routing, App.vue may be the parent of all the components, that is, regardless of the route to which page, this page will inherit App.vue the stuff, so this is somewhat new experience no matter which route to Vue interface will have a reason that the picture, as long as the App.vue pictures directly delete the line on the line, pay attention to only delete pictures that line, do not delete more than other places, or else weird question but also to find you, like on routing to other pages when only url on your browser has changed, the content has not changed the view, or the view goes blank, do not ask how I know first-hand experience. This tutorial is not complete, to tie in with other early online vue introductory tutorial to learn together. Happy learning! ! !

Guess you like

Origin www.cnblogs.com/Wszhurui/p/11955102.html