<style scoped>
.home {
    width: 460px;
    margin: auto;
}
.list-a-item {
    text-align: left;
    margin: 10px 0;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 14px;
}
.list-a-item h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
}
.list-a-item p {
    margin: 0
}
</style>

<template>
<div class="home">
    <test></test>
    <div class="list-a-item" v-for="item in list" :key="item.leadsId">
        <h4>{{ item.projectName }}</h4>
        <p>{{ item.abstract }}</p>
    </div>
</div>
</template>

<script>
// @ is an alias to /src
// import HelloWorld from '@/components/HelloWorld.vue'

export default {
    name: 'home',
    data(){
        return {
            list: []
        };
    },
    api(){
        let list;
        this.$api({
            url: '/data/list-tab-a.json',
            params: {
                tab: "feeds",
                page: 0,
                limit: 20
            }
        }).then(res => {
            list = res.data.data.ups.filter(item => item.type === "leads");
        });
        return new Promise((res ,rej) => {
            setTimeout(function(){ this.list = list; res(); }.bind(this), 1500);
        });
    },
    components: {
        'test': {
            data: () => ({ text: '组件的文字，2s后会修改' }),
            render(h){
                return h('h2', this.text);
            },
            created(){
                let _this = this;
                setTimeout(function(){
                    _this.text = "组件修改过的文字";
                }, 2000);
            }
        }
    }
}
</script>
