<template>
    <section class="channel_1 clearfix">
        <div class="channel_head_box clearfix phone_none">
            <div class="channel_head_a_name_box clearfix">
                <a class="channel_head_a_name" href="javascript:(void)" title="title">{{ title }}</a>
            </div>
            <div class="channel_head_a_img_box back100"></div>
            <nav class="channel_nav_box clearfix">
                <NuxtLink :to="{ path: `/${item.aLIas_pinyin}/list-1.html`}" class="channel_head_a" v-for="(item,index) in titleData">{{ item.alias }}</NuxtLink>
            </nav>
        </div>

        <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>

    </section>
</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_1 {
    width: 1200px;
    margin: 0 auto;
}
.channel_head_box {
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    border: solid 1px #D9D9D9;
    margin-top: 20px;
    box-sizing: border-box;
    border-bottom: solid 2px #489D97;
    background: #fafafa;
    box-sizing: border-box;
    display: flex;
    align-items: center;

    .channel_nav_box {
        flex: 1;
        padding: 9px 0px;
    }

    .channel_head_a {
        position: relative;
        height: 18px;
        line-height: 18px;
        color: #333;
        font-size: 14px;
        border-top-left-radius: 3px;
        border-top-right-radius: 3px;
        float: left;
        padding: 0px 24px;
        text-align: center;
        box-sizing: border-box;
        margin: 5px 0px 5px -2px;
        // width: 101px;

        &:hover {
            color: #489D97;
        }
    }

    .channel_head_a::after {
        content: '';
        display: block;
        position: absolute;
        width: 2px;
        height: 12px;
        background: #DBDBDB;
        top: 3px;
        left: -1px;
    }
}

.channel_head_a_name_box {
    display: flex;
    margin-top: auto;
}

.channel_head_a_name {
    background: #489D97;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    padding: 0px 15px;
    position: relative;
    height: 44px;
    line-height: 44px;
    font-size: 18px;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    padding: 0px 15px;
    text-align: center;
}

.channel_head_a_img_box {
    width: 36px;
    height: 34px;
    float: left;
    background-image: url(@/public/img/25.png);
    margin: 0px 20px 0px 19px;
}

.channel_head_a:nth-of-type(1)::after,.channel_head_a:nth-of-type(11)::after  {
    content: '';
    display: none;
}
</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_main{width:100%;}
            .index_nav{width:100%;}             
            .channel_1{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_in .router-link-exact-active.phone_nav_a{
                    color:#489D97;
                }

                .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_none{display:none;}
    }


</style>





