SecondaryHeading.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <nav class="channel_nav phone_none">
  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" :key="index" :title="item.alias"
  6. :to="{ path: `/${item.aLIas_pinyin}/list-1.html` }" class="channel_nav_a">
  7. {{ item.alias }}
  8. </NuxtLink>
  9. </div>
  10. </nav>
  11. <div class="phone_nav pc_none">
  12. <div class="phone_nav_in">
  13. <NuxtLink
  14. v-for="(item, index) in titleData" :key="index"
  15. :to="{ path: `/${item.aLIas_pinyin}/list-1.html`}" :title="item.alias"
  16. class="phone_nav_a"
  17. :target="item.is_url == 1 ? '_blank' : '_self'">
  18. {{ item.alias }}
  19. </NuxtLink>
  20. </div>
  21. </div>
  22. </template>
  23. <script setup>
  24. //1.设置组件数据 start---------------------------------------->
  25. //子导航
  26. const props = defineProps({
  27. titleData: Array,
  28. pinyinid: Number
  29. });
  30. //获取当前url路径
  31. const route = useRoute();
  32. //获得当前的完整路径
  33. const fullPath = route.path;
  34. const segments = fullPath.split('/');
  35. const targetSegment = segments[1];
  36. //1.设置组件数据 end---------------------------------------->
  37. //2.设置组件标题 start ---------------------------------------->
  38. const title = ref("")
  39. async function getPageData() {
  40. const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
  41. method: 'GET',
  42. query: {
  43. 'catid': props.pinyinid,
  44. },
  45. });
  46. if (mkdata.code == 200) {
  47. title.value = mkdata.data.alias;
  48. } else {
  49. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  50. console.log("错误位置:获取二级标题")
  51. console.log("后端错误反馈:", mkdata.message)
  52. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  53. }
  54. }
  55. getPageData();
  56. //2.设置组件标题 end ---------------------------------------->
  57. </script>
  58. <style lang="less" scoped>
  59. .channel_nav {
  60. width: 1200px;
  61. margin: 0 auto;
  62. border-bottom: solid 3px #004564;
  63. margin-top: 30px;
  64. display: flex;
  65. overflow: hidden;
  66. .channel_nav_head_name {
  67. margin: auto 2px 0px 0px;
  68. height: 44px;
  69. line-height: 44px;
  70. font-size: 30px;
  71. color: #fff;
  72. font-weight: bold;
  73. background: url(@/public/img/27.png) no-repeat right 0px;
  74. background-size: 100% 102%;
  75. padding: 0px 33px;
  76. box-sizing: border-box;
  77. }
  78. .channel_nav_a_box {
  79. flex: 1;
  80. margin-top: auto;
  81. overflow: hidden;
  82. }
  83. .channel_nav_a {
  84. float: left;
  85. height: 24px;
  86. line-height: 24px;
  87. color: #333;
  88. font-size: 18px;
  89. margin: 3px 10px 7px;
  90. font-weight: bold;
  91. // width: 88px;
  92. box-sizing: border-box;
  93. text-align: center;
  94. }
  95. .channel_nav_a:nth-of-type(10n) {
  96. margin-right: 0px;
  97. }
  98. }
  99. .back100 {
  100. background-size: 100% 100%;
  101. background-repeat: no-repeat;
  102. }
  103. </style>
  104. <style lang="less" scoped>
  105. @media screen and (min-width:801px){/*pc*/
  106. .pc_none{display:none;}
  107. }
  108. @media screen and (max-width:800px){/*ipad_phone*/
  109. .index_nav{width:100%;}
  110. .phone_nav{
  111. width:100%; box-sizing:border-box;background:#fafafa;
  112. margin:10px auto;height:33px;
  113. .phone_nav_in{ width:92%;margin:0px auto;
  114. overflow-x:auto;overflow-y:hidden;
  115. word-break: keep-all; white-space: nowrap;
  116. line-height:33px;
  117. height:33px;
  118. }
  119. .phone_nav_in::-webkit-scrollbar{height:0px;}
  120. .phone_nav_a{display:inline-block;line-height:33px;height:33px;
  121. color:#333;font-size:14px;margin:0px 10px;
  122. }
  123. .phone_nav_a:nth-of-type(1){margin-left:0px; }
  124. }
  125. .phone_nav_in .router-link-exact-active.phone_nav_a{
  126. color:#004564;
  127. }
  128. .phone_none{display:none;}
  129. }
  130. </style>