# 代码:
<template>
<div>
<ul class="demo">
<li v-for="(value,index) in pay_list" :key="value.broker_id">
<p>{{value.realname}}</p>
</li>
</ul>
</div>
</template>
<script>
export default {
name: "jsonp_demo",
data() {
return {
pay_list:[],
tranform: false
}
},
created() {
this.$http.get('http://127.0.0.1:8000/api/payuser.json').then((success) => {
// 请求成功,关闭loading
this.tranform = false;
// 由于请求成功返回的是Promise对象,我们要从success.body拿到数组
this.pay_list = success.body;
}, (error) => {
console.log(error)
})
},
mounted() {
this.get();
}
}
// css样式设置
</script>
<style>
.demo{
margin-top:35px;
}
</style>
网友评论