SecondaryHeading.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <main class="index_main">
  3. <nav class="channel_nav clearfix">
  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. </main>
  13. </template>
  14. <script setup>
  15. //1.设置组件数据 start---------------------------------------->
  16. //子导航
  17. const props = defineProps({
  18. titleData: Array,
  19. pinyinid: Number
  20. });
  21. //获取当前url路径
  22. const route = useRoute();
  23. //获得当前的完整路径
  24. const fullPath = route.path;
  25. const segments = fullPath.split('/');
  26. const targetSegment = segments[1];
  27. //1.设置组件数据 end---------------------------------------->
  28. //2.设置组件标题 start ---------------------------------------->
  29. const title = ref("")
  30. async function getPageData() {
  31. const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
  32. method: 'GET',
  33. query: {
  34. 'catid': props.pinyinid,
  35. },
  36. });
  37. if (mkdata.code == 200) {
  38. title.value = mkdata.data.alias;
  39. } else {
  40. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  41. console.log("错误位置:获取二级标题")
  42. console.log("后端错误反馈:", mkdata.message)
  43. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  44. }
  45. }
  46. getPageData();
  47. //2.设置组件标题 end ---------------------------------------->
  48. </script>
  49. <style lang="less" scoped>
  50. .channel_nav {
  51. background: #A91B33;
  52. margin: 30px auto 0px;
  53. position: relative;
  54. z-index: 11;
  55. display: flex;
  56. .channel_nav_a_head {
  57. word-break: keep-all;
  58. white-space: nowrap;
  59. display: block;
  60. background: #fff;
  61. border-top-left-radius: 7px;
  62. border-top-right-radius: 7px;
  63. position: relative;
  64. z-index: 22;
  65. font-size: 16px;
  66. font-weight: bold;
  67. height: 51px;
  68. line-height: 42px;
  69. color: #A91B33;
  70. margin: auto 21px 0px 35px;
  71. padding: 0px 40px;
  72. }
  73. .channel_nav_a_head::before {
  74. content: '';
  75. display: block;
  76. position: absolute;
  77. width: 64px;
  78. height: 2px;
  79. background: #A91B33;
  80. left: 50%;
  81. margin-left: -32px;
  82. bottom: 10px;
  83. }
  84. .channel_nav_right {
  85. flex: 1;
  86. padding: 10px 0px;
  87. }
  88. .channel_nav_a {
  89. float: left;
  90. height: 22px;
  91. line-height: 22px;
  92. position: relative;
  93. color: #fff;
  94. font-size: 16px;
  95. font-weight: bold;
  96. margin: 5px 13.5px;
  97. text-align: center;
  98. width: 96px;
  99. }
  100. .channel_nav_a::after {
  101. content: '';
  102. display: block;
  103. position: absolute;
  104. width: 1px;
  105. height: 14px;
  106. background: #BF3519;
  107. left: -14px;
  108. top: 5px;
  109. }
  110. }
  111. </style>