<template>
    <div class="ht-base-card-loading-demo">
        <ht-base-switch @on-change="change">
            <span slot="open">开</span>
            <span slot="close">关</span>
        </ht-base-switch>
        <div v-if="loading">
            <ht-base-card style="width: 300px;margin-top: 10px" dis-hover>
                <ht-base-card-meta title="卡片标题" avatar="http://39.106.250.14:8082/base-components/static/SuCo_user.svg">
                    <ul class="demo-meta-cont">
                        <li v-for="item in randomMovieList">
                            {{ item.name }}
                        </li>
                    </ul>
                </ht-base-card-meta>
            </ht-base-card>
            <ht-base-card style="width: 300px;margin-top: 10px" :action-icons="actionIcons" dis-hover>
                <ht-base-card-meta title="卡片标题" avatar="http://39.106.250.14:8082/base-components/static/SuCo_user.svg">
                    <ul class="demo-meta-cont">
                        <li v-for="item in randomMovieList">
                            {{ item.name }}
                        </li>
                    </ul>
                </ht-base-card-meta>
            </ht-base-card>
        </div>
        <div class="demo-loading demo-loading-style" v-else>
            <ht-base-card style="width: 300px;margin-top: 10px">
                <div class="demo-meta-avatar"></div>
                <ht-base-card-meta>
                    <ul class="demo-meta-cont">
                        <li v-for="item in randomMovieList"></li>
                    </ul>
                </ht-base-card-meta>
            </ht-base-card>
            <ht-base-card style="width: 300px;margin-top: 10px" :action-icons="actionIcons">
                <div class="demo-meta-avatar"></div>
                <ht-base-card-meta>
                    <ul class="demo-meta-cont">
                        <li v-for="item in randomMovieList"></li>
                    </ul>
                </ht-base-card-meta>
            </ht-base-card>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'HtBaseCardLoadingDemo',
        data() {
            return {
                loading: true,
                randomMovieList: [
                    {
                        name: '卡片内容'
                    },
                    {
                        name: '卡片内容'
                    }
                ],
                actionIcons: [
                    'LiRa_setup',
                    'LiRa_edit1',
                    'LiRa_more'
                ]
            }
        },
        methods: {
            change() {
                this.loading = !this.loading;
            }
        }
    }
</script>
<style lang="less">
    .ht-base-card-loading-demo {
        .demo-meta-cont {
            li {
                font-size: 13px;
                line-height: 28px;
            }
        }
        .demo-loading-style .demo-meta-avatar {
            float: left;
            width: 30px;
            height: 30px;
            background: linear-gradient(270deg, #fafafa 0%, #fafafa 0%, #f2f2f2 100%, #f2f2f2 100%);
            border-radius: 30px;
            margin-right: 25px;
        }
        .demo-loading-style .ht-base-card-meta .card-meta-title {
            width: 109px;
            height: 25px;
            background: linear-gradient(270deg, #fafafa 0%, #fafafa 0%, #f2f2f2 100%, #f2f2f2 100%);
        }
        .demo-loading-style .ht-base-card-meta .demo-meta-cont li {
            width: 200px;
            height: 18px;
            background: linear-gradient(270deg, #fafafa 0%, #fafafa 0%, #f2f2f2 100%, #f2f2f2 100%);
            margin-top: 7px;
        }
        .demo-loading-style .ht-base-card-meta .demo-meta-cont li:first-child {
            margin-top: 0;
        }
    }
</style>

