# 说明
网络模块底层是基于axios
,axios官网 (opens new window)
# GET
// 发起请求
window.cool.http.get('url').then(function (response) {
console.log(response);
}).catch(function (error) {
console.log(error);
});
# POST
// body参数形式的请求
const params = {
a: 1,
b: 2
}
window.cool.http.post('url', params, { headers: { Authorization: 'token' } }).then(function (response) {
console.log(response);
}).catch(function (error) {
console.log(error);
});
axios
还有很多用法,更多内容到axios官网 (opens new window)查看,如:拦截器
等