SecondaryHeading.vue 3.8 KB

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