<template>
    <div class="listNewsBox">
        <!-- 样式1 -->
        <div class="newsListSector" v-if="componentStyle == 1">
            <div v-for="item in listData.slice(0, 3)" class="photoText">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <img src="https://img.bjzxtw.org.cn/pre/image/png/20251112/1762939232690115.png" alt="">
                    <div class="newsListSectorRight">
                        <span class="title">{{ item.title }}</span>
                        <p class="desc">{{ item.introduce }}</p>
                        <span class="time">{{ item.updated_at }}</span>
                    </div>
                </NuxtLink>
            </div>
            <div v-for="item in listData.slice(3, 10)" class="text">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span class="title">{{ item.title }}</span>
                    <p class="desc">{{ item.introduce }}</p>
                    <span class="time">{{ item.updated_at }}</span>
                </NuxtLink>
            </div>
        </div>
        <!-- 样式2 -->
        <div class="newsListSector style2" v-if="componentStyle == 2">
            <div v-for="item in listData.slice(0, 3)" class="photoText">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <img src="https://img.bjzxtw.org.cn/pre/image/png/20251112/1762939232690115.png" alt="">
                    <div class="newsListSectorRight">
                        <span class="title">{{ item.title }}</span>
                        <p class="desc">{{ item.introduce }}</p>
                        <span class="time">{{ item.updated_at }}</span>
                    </div>
                </NuxtLink>
            </div>
            <div v-for="item in listData.slice(3, 10)" class="text">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span class="title">{{ item.title }}</span>
                    <p class="desc">{{ item.introduce }}</p>
                    <span class="time">{{ item.updated_at }}</span>
                </NuxtLink>
            </div>
        </div>
        <!-- 样式3 -->
        <div class="newsListSector style3" v-if="componentStyle == 3">
            <div v-for="item in listData.slice(0, 3)" class="photoText">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <img src="https://img.bjzxtw.org.cn/pre/image/png/20251112/1762939232690115.png" alt="">
                    <div class="newsListSectorRight">
                        <span class="title">{{ item.title }}</span>
                        <p class="desc">{{ item.introduce }}</p>
                        <span class="time">{{ item.updated_at }}</span>
                    </div>
                </NuxtLink>
            </div>
            <div v-for="item in listData.slice(3, 10)" class="text">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span class="title">{{ item.title }}</span>
                    <p class="desc">{{ item.introduce }}</p>
                    <span class="time">{{ item.updated_at }}</span>
                </NuxtLink>
            </div>
        </div>
        <!-- 样式4 -->
        <div class="newsListSector style4" v-if="componentStyle == 4">
            <div v-for="item in listData.slice(0, 3)" class="photoText">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <img src="https://img.bjzxtw.org.cn/pre/image/png/20251112/1762939232690115.png" alt="">
                    <div class="newsListSectorRight">
                        <span class="title">{{ item.title }}</span>
                        <p class="desc">{{ item.introduce }}</p>
                        <span class="time">{{ item.updated_at }}</span>
                    </div>
                </NuxtLink>
            </div>
            <div v-for="item in listData.slice(3, 10)" class="text">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span class="title">{{ item.title }}</span>
                    <p class="desc">{{ item.introduce }}</p>
                    <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 {
        .photoText {
            width: 100%;
            height: 180px;

            border-bottom: 1px dashed #cbcbcb;
            margin-bottom: 30px;
            cursor: pointer;

            a {
                display: flex;

                img {
                    width: 220px;
                    height: 160px;
                }

                .newsListSectorRight {
                    height: 160px;
                    padding-left: 30px;
                    display: flex;
                    flex-direction: column;
                    justify-content: center;

                    .title {
                        display: block;
                        width: 664px;
                        height: 24px;
                        line-height: 24px;
                        white-space: nowrap;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        color: #333333;
                        font-size: 23px;
                        font-weight: bold;
                        margin-bottom: 20px;
                    }

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

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

        .text {
            width: 100%;
            height: 175px;
            border-bottom: 1px dashed #cbcbcb;
            margin-bottom: 30px;
            cursor: pointer;

            a {
                color: #333333;

                .title {
                    display: block;
                    width: 900px;
                    height: 24px;
                    line-height: 24px;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    color: #333333;
                    font-size: 23px;
                    font-weight: bold;
                    margin-bottom: 20px;
                }

                .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 {
        .photoText {
            border-bottom: 1px solid #cbcbcb;
        }

        .text {
            border-bottom: 1px solid #cbcbcb;
        }
    }

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

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

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

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

        .text {
            border-bottom: 1px solid #cbcbcb;

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

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