SecondaryHeading.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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<=7">{{ item.alias }}</NuxtLink>
  6. </span>
  7. </nav>
  8. </template>
  9. <script setup>
  10. //1.设置组件数据 start---------------------------------------->
  11. //子导航
  12. const props = defineProps({
  13. titleData:Array,
  14. pinyinid:Number
  15. });
  16. //获取当前url路径
  17. const route = useRoute();
  18. //获得当前的完整路径
  19. const fullPath = route.path;
  20. const segments = fullPath.split('/');
  21. const targetSegment = segments[1];
  22. //1.设置组件数据 end---------------------------------------->
  23. //2.设置组件标题 start ---------------------------------------->
  24. const title = ref("")
  25. async function getPageData() {
  26. const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
  27. method: 'GET',
  28. query: {
  29. 'catid': props.pinyinid,
  30. },
  31. });
  32. if(mkdata.code == 200){
  33. title.value = mkdata.data.alias;
  34. }else{
  35. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  36. console.log("错误位置:获取二级标题")
  37. console.log("后端错误反馈:",mkdata.message)
  38. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  39. }
  40. }
  41. getPageData();
  42. //2.设置组件标题 end ---------------------------------------->
  43. </script>
  44. <style lang="less" scoped>
  45. .channel_nav {
  46. background: #A91B33;
  47. margin: 40px auto 0px;
  48. position: relative;
  49. z-index: 11;
  50. height: 61px;
  51. width:1200px;
  52. margin: 0 auto;
  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 29.4px;
  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>