This article to explain the use of Axios plug-ins, Axios is used to do data interaction plug-ins.
This article will be based on the Vue example to explain the use of the project's source code to expand the Vue-router.
Axios Steps to use:
1. Installing Axios npm Install Axios--save-dev
2. Introduction of Axios Import Axios from ' Axios ' on the page
3. For ease of use we hang the Axios to Vue.prototype. $http this prototype.
Vue.prototype. $http = Axios
4. Call the Axios method directly in the page
After the basic steps are clear, start the project below:
Create a data file in the static directory of the project to create a Article.dada file to hold the simulated data.
The structure is as follows:
Then in the Portal file Main.js import Axios
The code is as follows:
Then using Axios in the News.vue component, here is the core code.
When finished, the page works as follows:
Project Code Address:
Use of the Axios explained in Vue instance