SecondaryHeading.vue 3.0 KB

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