<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, index) in component_style1_News1Array_text">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span>{{ index + 1 }}</span>
                    {{ item.title }}
                </NuxtLink>
            </div>
        </div>
        <!--样式2-->
        <div class="listNewsContent style2" v-if="componentStyle == 2">
            <div v-for="(item, index) in component_style1_News1Array_text">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span>{{ index + 1 }}</span>
                    {{ item.title }}
                </NuxtLink>
            </div>
        </div>
        <!--样式3-->
        <div class="listNewsContent style3" v-if="componentStyle == 3">
            <div v-for="(item, index) in component_style1_News1Array_text">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span>{{ index + 1 }}</span>
                    {{ item.title }}
                </NuxtLink>
            </div>
        </div>
        <!--样式4-->
        <div class="listNewsContent style4" v-if="componentStyle == 4">
            <div v-for="(item, index) in component_style1_News1Array_text">
                <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'">
                    <span>{{ index + 1 }}</span>
                    {{ item.title }}
                </NuxtLink>
            </div>
        </div>
        <!--样式5-->
        <div class="listNewsContent" v-if="componentStyle == 5">
            <div v-for="item in component_style1_News1Array_text">
                <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,//样式编号
});

const component_style1_News1Array_text = ref([]);
//真实数据
component_style1_News1Array_text.value = props.templateData.textnum.slice(0, 7);
</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 {
        div {
            width: 380px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: #333333;
            font-size: 18px;
            margin-bottom: 16px;

            a {
                color: #333333;

                span {
                    font-family: DingTalk JinBuTi;
                    font-size: 20px;
                    color: #d9d9d9;
                    padding-right: 15px;
                }
            }

            &:nth-child(1),
            &:nth-child(2),
            &:nth-child(3) {
                span {
                    color: #154079;
                }
            }

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

    // 样式2
    .style2 {
        div {
            a {
                color: #333333;

                span {
                    color: #154079;
                }
            }
        }
    }

    // 样式3
    .style3 {
        div {
            a {
                color: #333333;

                span {
                    color: #d9d9d9;
                }
            }

            &:nth-child(1),
            &:nth-child(2),
            &:nth-child(3) {
                span {
                    color: #333333;
                }
            }
        }
    }

    // 样式4
    .style4 {
        div {
            a {
                color: #333333;

                span {
                    color: #333333;
                }
            }

            &:nth-child(1),
            &:nth-child(2),
            &:nth-child(3) {
                span {
                    color: #333333;
                }
            }
        }
    }
}

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