Axios 各种方法传递参数 Demo

版权声明:本文为博主原创文章,转载请注明出处 thx~ https://blog.csdn.net/x550392236/article/details/84958719

Axios 各种方法传递参数 Demo

get delete 方法较为不同

  • axios.get(url[, config])
  • axios.delete(url[, config])
  • axios.post(url[, data[, config]])
  • axios.put(url[, data[, config]])
  • axios.patch(url[, data[, config]])

get

Axios.get('demo/url', {
    params: {
        id: 123,
        name: 'Henry',
        sex: 1,
        phone: 13333333
    }
})

delete

Axios.delete('demo/url', {
    data: {
        id: 123,
        name: 'Henry',
        sex: 1,
        phone: 13333333
    }
})

post

Axios.post('demo/url', {
    id: 123,
    name: 'Henry',
    sex: 1,
    phone: 13333333
})

put

Axios.put('demo/url', {
    id: 123,
    name: 'Henry',
    sex: 1,
    phone: 13333333
})

patch

Axios.patch('demo/url', {
    id: 123,
    name: 'Henry',
    sex: 1,
    phone: 13333333
})

猜你喜欢

转载自blog.csdn.net/x550392236/article/details/84958719
今日推荐