If you want to send a key-value pair, you actually need to respond. Just upload the code.
npm install --save axios vue-axios qs
qs is an indispensable plug-in. After the installation is completed, insert the code.
//Load axiosimport Qs from 'qs' import axios from 'axios' import VueAxios from 'vue-axios' var axios_instance = ({ baseURL:'http://localhost', transformRequest: [function (data) { data = (data); return data; }], headers:{'Content-Type':'application/x-www-form-urlencoded'} }) (VueAxios, axios_instance)
This is done, and it can be used in the vue module
this.$('url', { id:1 }).then(response => { (response) }).catch( error => { (error); });
It can be seen that when parameters are easy to use, there is no need to add the params key. Just pass the parameter object directly, it's very convenient!
The above example of axios sending key-value pair post data in the form request form is all the content I share with you. I hope you can give you a reference and I hope you can support me more.