vue use axios

Before and after the end of the separation, data exchange is through the data interface, and then how to deliver and retrieve data through axios vue on it?

In the first project to install axios vue plug-enter the command line  npm install axios -S install plug axios

 

 

Press after installation is complete you can use, and the introduction of the desired page:

  import axios from 'axios';
  import qs from 'qs';

 

 

Then use axios

 

 The method is so simple to use, and a little more complicated, of course, is to create a file and then as a public api file, and then on the page by using the mount on the instance, not be introduced here.

Guess you like

Origin www.cnblogs.com/hermit-gyqy/p/12133490.html