axios
一、先引入js
第一种:通过cdn加载
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
第二种:通过npm或者cnpm加载
$ npm install axios
或者
$ cnpm install axios
二、请求与下载
请求第一种:
axios.get(url).then(function(response){
console.log(response);
}).catch(function(error){
console.log(error);
})
请求第一种:
//m,n表示url后面的参数,这是御用传参时使用,也就是url后面的参数放在外部执行
dict={
m:a,
n:b
}
axios.get(url,{params:dict}).then(function(response){
console.log(response);
}).catch(function(error){
console.log(error);
})