get请求
import Axios from './config'
Axios.get('/user?id=1')
.then(response => {})
.catch(error => {})
post请求
import Axios from './config'
Axios.post('/user', {
id: 1,
name: 'user'
})
.then(response => {})
.catch(error => {})
put请求
import Axios from './config'
Axios.put('/user', {
id: 1,
name: 'user'
})
.then(response => {})
.catch(error => {})
delete请求
import Axios from './config'
Axios.delete('/user?id=1')
.then(response => {})
.catch(error => {})
PS:'./config'
代码,请查看《Vue中如何实现Axios封装》
沃梦达教程
本文标题为:Vue中Axios常用方法有哪些?


猜你喜欢
- vue3+ts+elementPLus实现v-preview指令 2023-07-09
- HTML基础知识总结 2022-11-20
- css中引入svg来兼容部分安卓机显示0.5px边框的示例 2024-02-24
- vue项目中解决 IOS + H5 滑动边界橡皮筋弹性效果(解决思路) 2024-02-20
- VUE项目引入微信JSSDK 实现微信自定义分享 2023-10-08
- JS 新增Cookie 取cookie值 删除cookie 举例详解 2024-02-13
- vue后台管理、APP项目总结集合 2023-10-08
- Vue页面跳转传递参数及接收 2023-10-08
- css3 transform及原生js实现鼠标拖动3D立方体旋转 2024-02-07
- Photoshop CC教程:您必须知道的CC新功能详细介绍 2024-02-06