<template>
    <div class="newsBox">
        <div class="listNewsTitle" v-if="skinId==1">
            最新资讯
        </div>
        <div class="listNewsTitle_skin2" v-if="skinId==2">
            <span>最新资讯</span>
        </div>
        <div class="newsContent">
            <div v-for="item in component_style1_News1Array" class="newsContentImg">
                <NuxtLink 
                    :href="getLinkPathDetail(item)" 
                    :title="item.title"
                    :target="item.islink == 1 ? '_blank' : '_self'"
                >
                    <img :src="item.imgurl" />
                    <div>{{ item.title }}</div>
                </NuxtLink>
            </div>
            <div v-for="item in component_style1_News2Array" class="newsContentText">
                <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({
    templateData:Array,//新闻数据
    skinId:String,//皮肤id
});
const component_style1_News1Array = ref([]);
const component_style1_News2Array = ref([]);
component_style1_News1Array.value = props.templateData.img.slice(0,2);
component_style1_News2Array.value = props.templateData.text.slice(0,4);
</script>

<style lang="less" scoped>
.newsBox {
    .listNewsTitle {
        font-size:22px;
        font-weight:bold;
        height: 40px;
        line-height: 40px;
        border-bottom: 2px solid #004564;
        color:#004564;
        margin-bottom: 20px;
        box-sizing: border-box;
    }
    .listNewsTitle_skin2 {
        font-size:22px;
        font-weight:bold;
        height: 40px;
        line-height: 40px;
        border-bottom: 2px solid #A91B33;
        color:#A91B33;
        margin-bottom: 20px;
        box-sizing: border-box;
        span {
            color:#A91B33;
            height: 30px;
            line-height: 30px;
            border-left: 3px solid #A91B33;
            padding-left: 12px;
        }
    }
    .newsContent {
        .newsContentImg {
            a {
                display: block;
                display: flex;
                align-items: center;
                justify-content: center;
                margin-bottom: 20px;
                font-size:18px;
                div {
                    overflow: hidden;
                    display: -webkit-box;
                    -webkit-line-clamp: 3;
                    -webkit-box-orient: vertical;
                    text-overflow: ellipsis;
                    color:#333333;
                }
            }
            img {
                display: block;
                margin-right: 10px;
                width: 120px;
                height: 80px;
            }
        }
        .newsContentText {
            font-size:18px;
            color:#333333;
            margin-bottom: 20px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            a {
                color:#333333;
            }
        }
    }
}
</style>