axios.get(url, {
params: { ‘key’: ‘value’ }
}).then(function (response) {
alert(”.concat(response.data, ‘\r\n’, response.status, ‘\r\n’, response.statusText, ‘\r\n’, response.headers, ‘\r\n’, response.config));
}).catch(function (error) {
alert(error);
});
//对应服务端获取数据
//POST方法
var params = new URLSearchParams();
params.append(‘key’, ‘value’);
axios.post(url, params).then(function (response) {
alert(”.concat(response.data, ‘\r\n’, response.status, ‘\r\n’, response.statusText, ‘\r\n’, response.headers, ‘\r\n’, response.config));
}).catch(function (error) {
alert(error);
});
//对应服务端获取数据
此种写法猜测应该只是一种比较简单的实现,希望能够帮到其他人,同时希望高手指教;
关注“qietuwang”微信公众号,获取一手干货内容推送
本文由切图网原创,转载请保留版权:
微信扫一扫二维码访问