``
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>vue-resource ajax请求</title>
<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
<script src="https://cdn.staticfile.org/vue-resource/1.5.1/vue-resource.min.js"></script>
</head>
<body>
<div id="box">
<ol>
<li v-for="site in sites">
{{ site.name }}
</li>
</ol>
</div>
<script type = "text/javascript">
window.onload = function(){
var vm = new Vue({
el:'#box',
data:{
sites: []
},
created: function () {
//发送get请求
this.$http.jsonp('https://www.test.com/index.php/api/v1/category').then(function(res){
this.sites = res.body.data.son;
},function(){
console.log('请求失败处理');
});
}
});
}
</script>
</body>
</html>``