SecondaryHeading.vue 2.6 KB

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