Axios REST API 传参

129 阅读1分钟

Axios REST API 传参

axios.get('/user?ID=12345').then(function (response) {
    // Do something
})

axios.get('/user', {
    params: {
        ID: 12345
    }
}).then(function (response) {
    // Do something
})

axios.post('any-url', payload).then(
    // payload is the body of the request
    // Do something
)

axios.patch('any-url', payload).then(
    // payload is the body of the request
    // Do something
)

axios.delete('url', { data: payload }).then(response => {
    var result = response.data;
    // Observe the data keyword this time. Very important
    // payload is the request body
    // Do something
})