SecondaryHeading_shukan.vue 4.1 KB

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