SecondaryHeading.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <template>
  2. <nav class="channel_nav_box phone_none">
  3. <a class="channel_nav_head" href="javascript:(void)" title="title">{{ title }}</a>
  4. <div class="channel_nav_a_box clearfix">
  5. <NuxtLink
  6. :to="{ path: `/${item.aLIas_pinyin}/list-1.html`}"
  7. class="channel_nav_a"
  8. v-for="item in titleData"
  9. >
  10. {{ item.alias }}
  11. </NuxtLink>
  12. </div>
  13. </nav>
  14. <div class="phone_nav pc_none">
  15. <div class="phone_nav_in">
  16. <NuxtLink
  17. v-for="(item, index) in titleData" :key="index"
  18. :to="{ path: `/${item.aLIas_pinyin}/list-1.html`}"
  19. class="phone_nav_a"
  20. :target="item.is_url == 1 ? '_blank' : '_self'">
  21. {{ item.alias }}
  22. </NuxtLink>
  23. </div>
  24. </div>
  25. </template>
  26. <script setup>
  27. //1.设置组件数据 start---------------------------------------->
  28. //子导航
  29. const props = defineProps({
  30. titleData:Array,
  31. pinyinid:Number
  32. });
  33. //获取当前url路径
  34. const route = useRoute();
  35. //获得当前的完整路径
  36. const fullPath = route.path;
  37. const segments = fullPath.split('/');
  38. const targetSegment = segments[1];
  39. //1.设置组件数据 end---------------------------------------->
  40. //2.设置组件标题 start ---------------------------------------->
  41. const title = ref("")
  42. async function getPageData() {
  43. const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
  44. method: 'GET',
  45. query: {
  46. 'catid': props.pinyinid,
  47. },
  48. });
  49. if(mkdata.code == 200){
  50. title.value = mkdata.data.alias;
  51. }else{
  52. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  53. console.log("错误位置:获取二级标题")
  54. console.log("后端错误反馈:",mkdata.message)
  55. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  56. }
  57. }
  58. getPageData();
  59. //2.设置组件标题 end ---------------------------------------->
  60. </script>
  61. <style lang="less" scoped>
  62. .channel_nav_box {
  63. display:flex;
  64. width: 1200px;
  65. margin: 0 auto;
  66. background: url(http://img.bjzxtw.org.cn/master/www/snscw/5.png) no-repeat bottom;
  67. background-size:100% auto;
  68. margin-top: 20px;
  69. .channel_nav_head {
  70. width: 122px;
  71. text-align: center;
  72. height: 60px;
  73. line-height: 60px;
  74. color: #fff;
  75. margin: 0px 70px 0px 31px;
  76. box-sizing:border-box;
  77. margin-top:auto;
  78. font-size:20px;
  79. font-weight:bold;
  80. }
  81. .channel_nav_a_box{
  82. flex:1;
  83. padding:12px 0px;
  84. }
  85. .channel_nav_a {
  86. float: left;
  87. height: 26px;
  88. line-height: 26px;
  89. color: #255590;
  90. font-size: 20px;
  91. margin: 5px 19px;
  92. font-weight: bold;
  93. }
  94. }
  95. </style>
  96. <style lang="less" scoped>
  97. @media screen and (min-width:801px){/*pc*/
  98. .pc_none{display:none;}
  99. }
  100. @media screen and (max-width:800px){/*ipad_phone*/
  101. .index_nav{width:100%;}
  102. .phone_nav{
  103. width:100%; box-sizing:border-box;background:#fafafa;
  104. margin:10px auto;height:33px;
  105. .phone_nav_in{ width:92%;margin:0px auto;
  106. overflow-x:auto;overflow-y:hidden;
  107. word-break: keep-all; white-space: nowrap;
  108. line-height:33px;
  109. height:33px;
  110. }
  111. .phone_nav_in::-webkit-scrollbar{height:0px;}
  112. .phone_nav_a{display:inline-block;line-height:33px;height:33px;
  113. color:#333;font-size:14px;margin:0px 10px;
  114. }
  115. .phone_nav_a:nth-of-type(1){margin-left:0px; }
  116. }
  117. .phone_none{display:none;}
  118. }
  119. </style>