<template>
    <div class="listNewsBox">
        <div class="listNewsTitle">
            <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
                <div>{{ titleLink.alias }}</div>
            </NuxtLink>
        </div>
        <!--样式1-->
        <div class="listNewsContent" v-if="componentStyle == 1">
            <div v-for="item in component_style1_News1Array_1">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    {{ item.title }}
                </NuxtLink>
            </div>
        </div>
        <!--样式2-->
        <div class="listNewsContent style2" v-if="componentStyle == 2">
            <div v-for="item in component_style1_News1Array_1">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    {{ item.title }}
                </NuxtLink>
            </div>
        </div>
        <!--样式3-->
        <div class="listNewsContent style3" v-if="componentStyle == 3">
            <div v-for="item in component_style1_News1Array_1">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    {{ item.title }}
                </NuxtLink>
            </div>
        </div>
        <!--样式4-->
        <div class="listNewsContent style4" v-if="componentStyle == 4">
            <div v-for="item in component_style1_News1Array_1">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    {{ item.title }}
                </NuxtLink>
            </div>
        </div>
    </div>
</template>

<script setup>
//引入vue
import { ref } from 'vue';
//获得新闻数据
const props = defineProps({
    titleLink: Object,//板块名称
    templateData: Array,//新闻数据
    componentStyle: Number,//样式编号
});

//样式1与样式2共用 start ---------------------------------------->
const component_style1_News1Array = ref([]);
const component_style1_News1Array_1 = ref([]);
//真实数据
component_style1_News1Array.value = props.templateData.textnum;
component_style1_News1Array_1.value = props.templateData.textnum.slice(0, 6); //第1-6条

//样式1与样式2共用 end ---------------------------------------->
</script>

<style lang="less" scoped>
//基本样式 start ---------------------------------------->
.listNewsBox {
    position: relative;

    .listNewsTitle {
        height: 38px;
        line-height: 38px;
        margin-bottom: 19px;

        div {
            height: 35px;
            width: 138px;
            line-height: 32px;
            font-size: 22px;
            font-weight: bold;
            color: #333333;
            cursor: pointer;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            color: #154079;
            padding-bottom: 5px;
            background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042138413493.png") bottom left no-repeat;
        }
    }

    .listNewsContent {
        width: 100%;
        box-sizing: border-box;

        div {
            color: #666666;
            font-size: 18px;
            margin-bottom: 18px;
            cursor: pointer;

            &:first-child {
                height: 48px;
                line-height: 24px;
                color: #333333;
                font-weight: bold;
                width: 380px;
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 2;
                overflow: hidden;
                text-overflow: ellipsis;
                word-break: break-all;

                a {
                    color: #333333;
                }
            }

            &:nth-child(2),
            &:nth-child(3),
            &:nth-child(4),
            &:nth-child(5),
            &:nth-child(6) {
                width: 370px;
                color: #666666;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                padding-left: 16px;
                background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042944885873.png") no-repeat left center;

                a {
                    color: #666666;
                }
            }

            &:last-child {
                margin-bottom: 0;
            }
        }
    }

    // 样式2
    .style2 {
        div {
            &:first-child {
                font-weight: 400;
            }

            a {
                color: #333333;
            }
        }
    }

    // 样式3
    .style3 {
        div {

            &:nth-child(2),
            &:nth-child(3),
            &:nth-child(4),
            &:nth-child(5),
            &:nth-child(6) {
                padding-left: 16px;
                background: url("http://192.168.1.234:19000/pre/image/png/20251218/176604296168575.png") no-repeat left center;

                a {
                    color: #666666;
                }
            }
        }
    }

    //样式4
    .style4 {
        div {
            &:first-child {
                font-weight: 400;
            }

            &:nth-child(2),
            &:nth-child(3),
            &:nth-child(4),
            &:nth-child(5),
            &:nth-child(6) {
                padding-left: 16px;
                background: url("http://192.168.1.234:19000/pre/image/png/20251218/176604296168575.png") no-repeat left center;

                a {
                    color: #666666;
                }
            }

            a {
                color: #333333;
            }
        }
    }
}

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