<template>
    <div class="listNewsBox">
        <div class="listNewsTitle">
            <NuxtLink v-if="titleLink1.cid" :href="getLinkPath(titleLink1)" :title="titleLink1.alias">
                <div :class="{ activeTab: activeTab == 0 }" @mouseenter="activeTab = 0">{{ titleLink1.alias }}</div>
            </NuxtLink>
            <NuxtLink v-if="titleLink2.cid" :href="getLinkPath(titleLink2)" :title="titleLink2.alias">
                <div :class="{ activeTab: activeTab == 1 }" @mouseenter="activeTab = 1">{{ titleLink2.alias }}</div>
            </NuxtLink>
        </div>
        <!--样式1-->
        <div class="listNewsContent" v-if="componentStyle == 1">
            <div class="box1" v-if="activeTab == 0">
                <div v-for="item in component_style1_News1Array">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" alt="">
                        <span>{{ item.title }}</span>
                    </NuxtLink>
                </div>
            </div>
            <div class="box1" v-if="activeTab == 1">
                <div v-for="item in component_style1_News1Array_1">
                    <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
                        :target="item.islink == 1 ? '_blank' : '_self'">
                        <img :src="item.imgurl" alt="">
                        <span>{{ item.title }}</span>
                    </NuxtLink>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
//引入vue
import { ref } from 'vue';
//获得新闻数据
const props = defineProps({
    titleLink1: Object,//板块1名称
    titleLink2: Object,//板块2名称
    templateData: Array,//新闻数据
    templateData1: Array,//新闻数据
    componentStyle: Number,//样式编号
});
//当前选中的tab
const activeTab = ref(0);

const component_style1_News1Array = ref([]);
const component_style1_News1Array_1 = ref([]);
//真实数据
component_style1_News1Array.value = props.templateData.imgnum;
component_style1_News1Array_1.value = props.templateData1.imgnum;



</script>

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

    .listNewsTitle {
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        height: 38px;
        margin-bottom: 20px;

        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;
            padding-bottom: 5px;

            &.activeTab {
                color: #154079;
                background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042138413493.png") bottom left no-repeat;
            }
        }
    }

    .listNewsContent {
        width: 380px;
        height: 268px;

        div {
            width: 380px;
            height: 268px;
            position: relative;

            a {
                color: #fff;

                img {
                    width: 380px;
                    height: 268px;
                }

                span {
                    position: absolute;
                    bottom: 0;
                    left: 0;
                    display: inline-block;
                    width: 380px;
                    height: 50px;
                    line-height: 50px;
                    font-size: 14px;
                    padding: 0 10px;
                    box-sizing: border-box;
                    color: #fff;
                    background-color: rgba(0, 0, 0, 0.2);
                    overflow: hidden;
                    text-overflow: ellipsis;
                    white-space: nowrap;
                }
            }
        }
    }
}

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