axios的使用

一、axios的安装: 终端中输入: npm install axios --save

二、axios的引入:  import axios from "axios";  (如果是vue项目在index.js中引入)

三、axios -> 发送get请求

1) 无参数:

 

 2) 带参数: 

将参数写在url中: 模板字符串

 

字符串拼接

 

将参数写在params中:

  四、axios -> 发送post请求

 

 

原文地址:https://www.cnblogs.com/yunyin/p/14809715.html