Vue中Axios常用方法有哪些?
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封装》