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常用方法有哪些?
基础教程推荐
猜你喜欢
- JavaScrpt中如何使用 cookie 设置查看与删除功能 2024-01-12
- JavaScript获取鼠标移动时的坐标(兼容IE8、chome谷歌、Firefox) 2023-11-30
- 详解CSS盒子塌陷的5种解决方法 2024-01-08
- JS自调用匿名函数具体实现 2023-12-15
- JavaScript定时器类型总结 2023-08-12
- 【vue】 export、export default、import的用法和区别 2023-10-08
- Bootstrap Multiselect 常用组件实现代码 2023-12-26
- DW网页元素怎么制作渐隐渐现效果? 2024-02-07
- vue的特定以及优势所在 2023-10-08
- ExtJS 3.x DateField menuListeners 显示/隐藏 2022-09-15
