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常用方法有哪些?


基础教程推荐
猜你喜欢
- CSS实现三角效果的简单实例 2024-02-04
- Ajax客户端异步调用服务端的实现方法(js调用cs文件) 2023-02-14
- Ajax简单的异步交互及Ajax原生编写 2022-12-18
- js中window.open()的所有参数详细解析 2024-03-08
- 解析使用useDark(),发现transition 动画失效 2023-07-09
- Layui - Vue启用日间模式/夜间模式 2025-01-12
- AJAX显示加载中并弹出图层遮挡页面的实现示例 2023-01-26
- 如何使用AJAX实现按需加载【推荐】 2022-12-28
- css scroll-snap控制滚动元素的实现 2023-12-29
- web前端性能优化之合理的优化网站图片可以带来更多的流量 2024-01-23