axios是基于Promise的HTTP库,用于数据请求。
在vue中需要安装和引入

$ npm install axios -S

发送一个最简单的请求

this.$axios.post('https://jsonplaceholder.typicode.com/todos')
.then(function(res){
  console.log(res);
})
.catch(function(err){
  console.log(err);
});

jsonplaceholder是一个在线引用的可以请求的地址 免费的;
promise()这个对象还需要在深入学习一下。

var on = document.getElementsByClassName("on")[0];
axios('https://jsonplaceholder.typicode.com/todos').then(res => {
console.log('请求结果:', res.data);
for(var i=0;i<res.data.length;i++){
var p = document.createElement("p");
on.appendChild(p);
p.innerHTML = res.data[i].title;
}
});