axios的使用

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

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

三、axios -> 发送get请求

1) 无参数:

 

 

 

 2) 带参数: 

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

 

 

字符串拼接

 

将参数写在params中:

 

  四、axios -> 发送post请求

 

 

 

 

 

 

 

 

 

 

 

 

posted @ 2021-05-25 17:28  云里知音  阅读(154)  评论(0编辑  收藏  举报