VUE实现请求数据

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="js/vue.js"></script>
<script src="js/axios.min.js"></script>
</head>
<body>
<div class="app">
<ul>
<li v-for="(item,index) in list">{{item.title}}{{item.time}}{{item.price}}</li>
</ul>
</div>

<script>
var vm=new Vue({
el:".app",
data:{
list:[]
},
mounted(){
axios({
method: 'post',
url: 'json/js1.json',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
}
}).then(function(data){
vm.list=data.data.exclude;
console.log(this.list)
});
}
});
</script>
</body>
</html>
posted @ 2017-10-13 16:08  乐得逍遥  阅读(1843)  评论(0编辑  收藏  举报