Axios post request. The backend cannot receive data, and neither can querystring.

1.post request. After querystringfy serializes url, the backend cannot receive data. It is initially found that because there is an array in post data, querystringfy serializes the array directly into an empty string
2. The request data format is as follows:

{
  "goodsList": [
    {
      "goodsId": 41,
      "salePrice": 11,
      "discount": 0,
      "amount": 3,
      "memo": "",
      "empId": ""
    }
  ],
  "shopId": 5,
  "memo": "123",
  "pno": "20",
  "empId": "14",
  "hangType": 2
}

3. The request code is as follows:

clipboard.png

4.:

clipboard.png

Mar.12,2021

The second parameter of the post interface of

axios is the data carried by the request, and the type must be an object, because the
source code request gets the parameter. Give it to source code merge logic to merge the second parameter, so your qs.stringify (data), is directly converted into a string. The data merge is definitely not merged. You can write data
like this

.
this.axios.post('url', data).then(res => console.log(res.data))

try


post data should be put in the data attribute, eg:

return request({
    url: '/admin/login',
    method: 'post',
    data: {
        username,
        password
    }
})

this.$post ("/ wechat/login/getSmsCode?phone=" + this.phone)

or after axios.create ()

export const post = (url, params) = > {
return axios ({

method: 'post',
url: `${base}${url}`,
data: params,
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'
}

});
}

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5ac17-4430d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5ac17-4430d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?