<template>
    <div class="listNewsBox">
        <!-- 样式1 -->
        <div class="newsListSector" v-if="componentStyle == 1">
            <div class="content" v-for="item in listData.slice(0, 10)">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span class="title">{{ item.title }}</span>
                    <span class="time">{{ item.updated_at }}</span>
                </NuxtLink>
            </div>
        </div>
        <!-- 样式2 -->
        <div class="newsListSector" v-if="componentStyle == 2">
            <div class="content style2" v-for="item in listData.slice(0, 10)">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span class="title">{{ item.title }}</span>
                    <span class="time">{{ item.updated_at }}</span>
                </NuxtLink>
            </div>
        </div>
        <!-- 样式3 -->
        <div class="newsListSector" v-if="componentStyle == 3">
            <div class="content style3" v-for="item in listData.slice(0, 10)">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span class="title">{{ item.title }}</span>
                    <span class="time">{{ item.updated_at }}</span>
                </NuxtLink>
            </div>
        </div>
        <!-- 样式4 -->
        <div class="newsListSector" v-if="componentStyle == 4">
            <div class="content style4" v-for="item in listData.slice(0, 10)">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span class="title">{{ item.title }}</span>
                    <span class="time">{{ item.updated_at }}</span>
                </NuxtLink>
            </div>
        </div>

    </div>
</template>

<script setup>
//引入vue
import { ref } from 'vue';
//获得新闻数据
const props = defineProps({
    listData: Array,//新闻数据
    componentStyle: Number//组件样式
});
</script>

<style lang="less" scoped>
//基本样式 start ---------------------------------------->
.listNewsBox {
    .newsListSector {
        .content {
            width: 100%;
            height: 99px;
            border-bottom: 1px dashed #cbcbcb;
            margin-bottom: 20px;
            cursor: pointer;

            .title {
                display: block;
                height: 24px;
                line-height: 24px;
                color: #333333;
                font-size: 18px;
                font-weight: bold;
                margin-bottom: 25px;
            }

            .desc {
                height: 63px;
                line-height: 20px;
                color: #666666;
                font-size: 18px;
                font-family: "Abhaya Libre", serif;
                margin-bottom: 20px;
                overflow: hidden;
            }

            .time {
                font-family: "Abhaya Libre", serif;
                font-size: 18px;
                color: #666666;
            }
        }

        // 样式2
        .style2 {
            border-bottom: 1px solid #cbcbcb;
        }

        // 样式3
        .style3 {
            .title {
                font-weight: 400;
            }
        }

        // 样式4
        .style4 {
            border-bottom: 1px solid #cbcbcb;

            .title {
                font-weight: 400;
            }
        }
    }
}

//基本样式 end ----------------------------------------></style>