window.onload = function(){
var vm = new Vue({
el:'#box',
data:{
msg:'Hello World!',
},
methods:{
get:function(){
//发送get请求
this.$http.get('url地址').then(function(res){
document.write(res.body);
},function(){
console.log('请求失败处理');
});
}
}
});
}
模拟了一次vue的ajax请求