import axios from 'axios'
let data = {"code":"1234","name":"yyyy"};
axios.post(`${this.$url}/test/testRequest`,data)
.then(res=>{
    console.log('res=>',res);            
})

axios post提交数据的三种请求方式

 

2、Content-Type: multipart/form-data

import axios from 'axios'
let data = new FormData();
data.append('code','1234');
data.append('name','yyyy');
axios.post(`${this.$url}/test/testRequest`,data)
.then(res=>{
    console.log('res=>',res);            
})

axios post提交数据的三种请求方式

 

3、Content-Type: application/x-www-form-urlencoded

import axios from 'axios'
import qs from 'Qs'
let data = {"code":"1234","name":"yyyy"};
axios.post(`${this.$url}/test/testRequest`,qs.stringify(
    data
))
.then(res=>{
    console.log('res=>',res);            
})

axios post提交数据的三种请求方式

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
  • 2021-11-19
  • 2021-11-19
  • 2021-09-14
  • 2021-10-17
猜你喜欢
  • 2022-01-20
  • 2022-12-23
相关资源
相似解决方案