axios使用小记

2021-08-12  本文已影响0人  在小白的路上越走越远
axios({
  method: 'post',
    url: 'api/audit',
    params: {
    id: row.id 
   }
}).then(res=>{})

const methods = params => axios.post('api/audit',null,{params})
methods({id: row.id}).then(res=>{})
axios({
  method: 'post',
    url: 'api/audit',
    data: {
    id: row.id 
   }
})

const methods = params => axios.post('api/audit',params)
methods({id: row.id}).then(res=>{})
axios({
  url: url,
  method: ‘get‘,
  params: {
  id: row.id  
  }
})

axios.get(url[, config])
const methods = params => axios.get('api/audit',{params})
methods({id: row.id}).then(res=>{})

参考:https://www.jianshu.com/p/53deecb09077 [Axios 各种请求方式传递参数格式]

上一篇下一篇

猜你喜欢

热点阅读