SecondaryHeading.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <div class="index_main">
  3. <nav class="index_nav clearfix">
  4. <div class="index_navTitle_box">
  5. <span class="index_nav_a_one" href="javascript:(void)" title="">{{ title }}</span>
  6. </div>
  7. <div class="index_nav_box">
  8. <span v-for="(item, index) in titleData"
  9. :class="['index_nav_a', { 'index_nav_a_only': targetSegment === item.aLIas_pinyin }]">
  10. <span v-if="index <= 20">
  11. <NuxtLink :to="{ path: `/${item.aLIas_pinyin}/list-1.html` }">{{ item.alias }}</NuxtLink>
  12. </span>
  13. </span>
  14. </div>
  15. </nav>
  16. </div>
  17. </template>
  18. <script setup>
  19. //1.设置组件数据 start---------------------------------------->
  20. //子导航
  21. const props = defineProps({
  22. titleData: Array,
  23. pinyinid: Number
  24. });
  25. //获取当前url路径
  26. const route = useRoute();
  27. //获得当前的完整路径
  28. const fullPath = route.path;
  29. const segments = fullPath.split('/');
  30. const targetSegment = segments[1];
  31. //1.设置组件数据 end---------------------------------------->
  32. //2.设置组件标题 start ---------------------------------------->
  33. const title = ref("")
  34. async function getPageData() {
  35. const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
  36. method: 'GET',
  37. query: {
  38. 'catid': props.pinyinid,
  39. },
  40. });
  41. if (mkdata.code == 200) {
  42. title.value = mkdata.data.alias;
  43. } else {
  44. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  45. console.log("错误位置:获取二级标题")
  46. console.log("后端错误反馈:", mkdata.message)
  47. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  48. }
  49. }
  50. getPageData();
  51. //2.设置组件标题 end ---------------------------------------->
  52. </script>
  53. <style lang="less" scoped>
  54. .index_main {
  55. width: 1200px;
  56. margin: 0 auto;
  57. margin-bottom: 40px;
  58. }
  59. .index_nav {
  60. width: 1200px;
  61. margin: 0 auto;
  62. margin-top: 20px;
  63. border-bottom: solid 1px #D9D9D9;
  64. height: 88px;
  65. .index_navTitle_box {
  66. float: left;
  67. height: 88px;
  68. line-height: 88px;
  69. font-size: 16px;
  70. font-weight: bold;
  71. color: #333;
  72. width: 153px;
  73. // margin: 0px 30px;
  74. }
  75. .index_nav_a_one {
  76. float: left;
  77. color: #333;
  78. font-size: 16px;
  79. margin: 0px 30px;
  80. height: 88px;
  81. line-height: 88px;
  82. font-weight: bold;
  83. border-bottom: solid 3px #fff;
  84. box-sizing: border-box;
  85. position: relative;
  86. overflow: hidden;
  87. height: 56px;
  88. line-height: 56px;
  89. color: #fff;
  90. font-size: 18px;
  91. font-weight: bold;
  92. width: 153px;
  93. margin: 14px 30px 0px 0px;
  94. text-indent: 46px;
  95. background: url(https://img.bjzxtw.org.cn/master/www/nmw/img/3.png) no-repeat left top;
  96. background-size: 100% 100%;
  97. }
  98. .index_nav_box {
  99. float: left;
  100. // height: 88px;
  101. // line-height: 88px;
  102. font-size: 16px;
  103. font-weight: bold;
  104. color: #333;
  105. width: 1009px;
  106. margin-top: 15px;
  107. margin-left: 25px;
  108. }
  109. .index_nav_a {
  110. float: left;
  111. color: #333;
  112. font-size: 16px;
  113. margin: 5px 30px;
  114. font-weight: bold;
  115. border-bottom: solid 3px #fff;
  116. box-sizing: border-box;
  117. position: relative;
  118. a {
  119. color: #333333
  120. }
  121. &:hover {
  122. border-bottom: solid 3px #D2600F;
  123. }
  124. }
  125. .index_nav_a a:hover {
  126. color: #D2600F;
  127. // border-bottom: solid 3px #D2600F;
  128. }
  129. .index_nav_a_only {
  130. border-bottom: solid 3px #D2600F;
  131. }
  132. .index_nav_a::after {
  133. content: '';
  134. display: block;
  135. position: absolute;
  136. width: 2px;
  137. height: 12px;
  138. background: #DBDBDB;
  139. right: -28px;
  140. top: 6px;
  141. }
  142. // .index_nav_a:nth-last-of-type(1) {
  143. // overflow: hidden;
  144. // }
  145. // a.index_nav_a:nth-of-type(1) {
  146. // overflow: hidden;
  147. // height: 56px;
  148. // line-height: 56px;
  149. // color: #fff;
  150. // font-size: 18px;
  151. // font-weight: bold;
  152. // width: 153px;
  153. // margin: 14px 30px 0px 0px;
  154. // text-indent: 46px;
  155. // background: url(https://img.bjzxtw.org.cn/master/www/nmw/img/3.png) no-repeat left top;
  156. // background-size: 100% 100%;
  157. // }
  158. }
  159. </style>