var params = new URLSearchParams(); params.append('param1', 'value1'); params.append('param2', 'value2'); axios.post('/foo', params);
import qs from 'qs'; this.$axios.post("/xx/login.do", qs.stringify({ 'username': username, 'password':password, }),{ headers: {'Content-Type': 'application/x-www-form-urlencoded'}, }).then(res => { let data = res.data; console.info(data); })
axios({ url: '/user', method: 'post', data: { firstName: 'Fred', lastName: 'Flintstone' }, transformRequest: [function (data) { // Do whatever you want to transform the data let ret = '' for (let it in data) { ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&' } return ret }], headers: { 'Content-Type': 'application/x-www-form-urlencoded' } })