<template>
    <nav class="channel_nav phone_none">
        <a class="channel_nav_head_name" href="javascript:(void)" :title="title">{{ title }}</a>
        <div class="channel_nav_a_box">
            <NuxtLink v-for="(item, index) in titleData" :key="index" :title="item.alias"
                :to="{ path: `/${item.aLIas_pinyin}/list-1.html` }" class="channel_nav_a">
                {{ item.alias }}
            </NuxtLink>
        </div>
    </nav>
    
    <div class="phone_nav pc_none">
        <div class="phone_nav_in">
            
            <NuxtLink 
                    v-for="(item, index) in titleData" :key="index"
                    :to="{ path: `/${item.aLIas_pinyin}/list-1.html`}" :title="item.alias"
                    class="phone_nav_a" 
                    :target="item.is_url == 1 ? '_blank' : '_self'">

                    {{ item.alias }}
            </NuxtLink>


        </div>
    </div>


</template>

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

//获取当前url路径
const route = useRoute();
//获得当前的完整路径
const fullPath = route.path;
const segments = fullPath.split('/');
const targetSegment = segments[1];
//1.设置组件数据 end---------------------------------------->

//2.设置组件标题 start ---------------------------------------->
const title = ref("")
async function getPageData() {
    const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
        method: 'GET',
        query: {
            'catid': props.pinyinid,
        },
    });
    if (mkdata.code == 200) {
        title.value = mkdata.data.alias;
    } else {
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
        console.log("错误位置：获取二级标题")
        console.log("后端错误反馈：", mkdata.message)
        console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
    }
}
getPageData();
//2.设置组件标题 end ---------------------------------------->
</script>

<style lang="less" scoped>
.channel_nav {
    width: 1200px;
    margin: 0 auto;
    border-bottom: solid 3px #004564;
    margin-top: 30px;
    display: flex;
    overflow: hidden;

    .channel_nav_head_name {
        margin: auto 2px 0px 0px;
        height: 44px;
        line-height: 44px;
        font-size: 30px;
        color: #fff;
        font-weight: bold;
        background: url(@/public/img/27.png) no-repeat right 0px;
        background-size: 100% 102%;
        padding: 0px 33px;
        box-sizing: border-box;
    }

    .channel_nav_a_box {
        flex: 1;
        margin-top: auto;
        overflow: hidden;
    }

    .channel_nav_a {
        float: left;
        height: 24px;
        line-height: 24px;
        color: #333;
        font-size: 18px;
        margin: 3px 10px 7px;
        font-weight: bold;
        // width: 88px;
        box-sizing: border-box;
        text-align: center;
    }

    .channel_nav_a:nth-of-type(10n) {
        margin-right: 0px;
    }
}

.back100 {
    background-size: 100% 100%;
    background-repeat: no-repeat;
}
</style>



<style lang="less" scoped>

 
    @media screen and (min-width:801px){/*pc*/
         
		
            .pc_none{display:none;}
    }
    @media screen and (max-width:800px){/*ipad_phone*/
            .index_nav{width:100%;}             
             .phone_nav{ 

                width:100%; box-sizing:border-box;background:#fafafa; 
                margin:10px auto;height:33px;

                .phone_nav_in{ width:92%;margin:0px auto;
                    overflow-x:auto;overflow-y:hidden; 
                    word-break: keep-all; white-space: nowrap;    
                       line-height:33px;
                        height:33px;
                }
                .phone_nav_in::-webkit-scrollbar{height:0px;}


                .phone_nav_a{display:inline-block;line-height:33px;height:33px;
                    color:#333;font-size:14px;margin:0px 10px;
                }
                .phone_nav_a:nth-of-type(1){margin-left:0px; }
            }
            .phone_nav_in .router-link-exact-active.phone_nav_a{
                    color:#004564;
                }
            .phone_none{display:none;}
    }


</style>


