SecondaryHeading.vue 4.8 KB

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