<template>
    <div class="index_main">
        <nav class="index_nav clearfix">
            <span class="index_nav_a_one" href="javascript:(void)">{{ name }}</span>
            <span v-for="(item,index) in nav" :class="['index_nav_a', { 'index_nav_a_only': targetSegment === item.aLIas_pinyin }]">
                <span v-if="index<=7">
                    <NuxtLink :to="{ path: `/${targetRoute}/${item.aLIas_pinyin}/list-1.html`}">{{ item.alias }}</NuxtLink>
                </span>
            </span>
        </nav>
    </div>
</template>

<script setup>
//1.设置组件数据 start---------------------------------------->
//子导航
const props = defineProps({
    name:String,
    nav:Array
});

//获取当前url路径
const route = useRoute();
//获得当前的完整路径
const fullPath = route.path;
const segments = fullPath.split('/'); 
const targetRoute = segments[1]; 

console.log(999)
console.log(targetRoute)
//1.设置组件数据 end---------------------------------------->

</script>

<style lang="less" scoped>
.index_main {
    width: 1200px;
    margin: 0 auto;
}
.index_nav {
    width: 1200px;
    margin: 0 auto;
    margin-top: 20px;
    border-bottom: solid 1px #D9D9D9;
    height: 88px;
    .index_nav_a_one {
        float: left;
        color: #333;
        font-size: 16px;
        margin: 0px 30px;
        height: 88px;
        line-height: 88px;
        font-weight: bold;
        border-bottom: solid 3px #fff;
        box-sizing: border-box;
        position: relative;
        overflow: hidden;
        height: 56px;
        line-height: 56px;
        color: #fff;
        font-size: 18px;
        font-weight: bold;
        width: 153px;
        margin: 14px 30px 0px 0px;
        text-indent: 46px;
        background: url(@/public/img/3.png) no-repeat left top;
        background-size: 100% 100%;
    }
    .index_nav_a {
        float: left;
        color: #333;
        font-size: 16px;
        margin: 0px 30px;
        height: 88px;
        line-height: 88px;
        font-weight: bold;
        border-bottom: solid 3px #fff;
        box-sizing: border-box;
        position: relative;
        a {
            color:#333333
        }
        &:hover{
            border-bottom: solid 3px #D2600F;
        }
    }
    .index_nav_a a:hover{
        color: #D2600F;
        // border-bottom: solid 3px #D2600F;
    }
    .index_nav_a_only {
        border-bottom: solid 3px #D2600F;
    }
    .index_nav_a::after {
        content: '';
        display: block;
        position: absolute;
        width: 2px;
        height: 12px;
        background: #DBDBDB;
        right: -38px;
        top: 39px;
    }
    .index_nav_a:nth-last-of-type(1) {
        overflow: hidden;
    }
    a.index_nav_a:nth-of-type(1) {
        overflow: hidden;
        height: 56px;
        line-height: 56px;
        color: #fff;
        font-size: 18px;
        font-weight: bold;
        width: 153px;
        margin: 14px 30px 0px 0px;
        text-indent: 46px;
        background: url(@/public/img/3.png) no-repeat left top;
        background-size: 100% 100%;
    }
}
</style>