<template>
    <div>
        <div class="channelMenuTitle" v-if="skinId==1">
            {{title}}
        </div>
        <div class="channelMenuTitle_skin2" v-if="skinId==2">
            {{title}}
        </div>
        <div class="channelMenuList" v-if="skinId==1">
            <div v-for="item in navigateData">
                <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">{{item.alias}}</NuxtLink>
            </div>
        </div>
        <div class="channelMenuList_skin2" v-if="skinId==2">
            <div v-for="item in navigateData">
                <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">{{item.alias}}</NuxtLink>
            </div>
        </div>
    </div>
</template>

<script setup>
//引入vue
import {ref} from 'vue';
//获得新闻数据
const props = defineProps({
    skinId:String,//组件样式
    navigateData:Array,//子导航数据
    routeId:Number//导航对应的cid
});
//获得导航名称
const title = ref("")
const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
    method: 'GET',
    query: {
        'catid': props.routeId,
    },
});
if (mkdata.code == 200) {
    title.value = mkdata.data.alias;
} 
//获取当前url路径
const route = useRoute();
//获得当前的完整路径
const fullPath = route.path;
const segments = fullPath.split('/');
const targetSegment = segments[1];
const targetSegment2 = segments[2];

//判断当前为第几层的列表页
// const routeLevel = ref(0);
// if(route.name == "dir-list-id"){
//     routeLevel.value = 1;
//     console.log("当前的路由层级为：" + routeLevel.value);
// }
// if(route.name == "dir-dir-list-id"){
//     routeLevel.value = 2;
//     console.log("当前的路由层级为：" + routeLevel.value);
// }
</script>

<style lang="less" scoped>
.channelMenuTitle {
    width: 1200px;
    height: 32px;
    line-height: 32px;
    font-size: 24px;
    color:#1C5468;
    font-weight: bold;
    text-align: center;
    background: url('http://img.bjzxtw.org.cn/pre/image/jpeg/20250620/1750381219965589.jpg') no-repeat center center;
    margin-bottom: 25px;
}
.channelMenuTitle_skin2 {
    width: 1200px;
    height: 32px;
    line-height: 32px;
    font-size: 24px;
    color:#A91B33;
    font-weight: bold;
    text-align: center;
    background: url('http://img.bjzxtw.org.cn/pre/image/jpeg/20250626/1750914827434788.jpg') no-repeat center center;
    margin-bottom: 25px;
}
.channelMenuList {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    color: #333;
    padding-bottom: 15px;
    div {
        font-size: 16px;
        font-weight: bold;
        width: 120px;
        height: 22px;
        line-height: 22px;
        a {
            color: #333;
            display: block;
            text-align: center;
            &:hover {
                color: #004564;
            }
        }
        a.active {
            color: #004564;
        }
        margin-right: 34px;
        &:last-child{
            margin-right: 0;
        }
    }
}
.channelMenuList_skin2 {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    color: #333;
    border-bottom: 2px solid #A91B33;
    padding-bottom: 15px;
    div {
        font-size: 16px;
        font-weight: bold;
        width: 120px;
        height: 22px;
        line-height: 22px;
        a {
            color: #333;
            display: block;
            text-align: center;
            &:hover {
                color: #A91B33;
            }
        }
        a.active {
            color: #A91B33;
        }
        margin-right: 34px;
        &:last-child{
            margin-right: 0;
        }
    }
}
</style>