axios发送post form请求
程序员文章站
2022-04-15 22:54:40
axios发送post form请求只需修改url和data即可 axios({ url: '/user', method: 'post', data: { firstName: 'Fred', lastName: 'Flintstone' }, transformRequest: [functio ......
axios发送post form请求
只需修改url和data即可
axios({ url: '/user', method: 'post', data: { firstname: 'fred', lastname: 'flintstone' }, transformrequest: [function (data) { let ret = '' for (let it in data) { ret += encodeuricomponent(it) + '=' + encodeuricomponent(data[it]) + '&' } return ret }], headers: { 'content-type': 'application/x-www-form-urlencoded' } })
上一篇: Hibernate search实践