合作联系微信: w6668263      合作联系电话:177-9238-7426     

axios 提交formData和json

引入qs

import qs from 'qs'

axios 提交formData

method: 'POST',
    data: {},
    headers: {
        "Content-Type": "application/x-www-form-urlencoded",
    },
    transformRequest: [
        params => {
            // console.log('paramsSerializer', params)
            return qs.stringify(params, { arrayFormat: 'repeat' })
        }
    ]

 

 

提交json

method: 'POST',
data: JSON.stringify(params),
headers: {
   'Content-Type': 'application/json'
},
transformRequest: null

 

posted on 2022-08-13 17:13  龙行龘龘9527  阅读(634)  评论(0编辑  收藏  举报

导航