SecondaryHeading.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div class="index_main">
  3. <nav class="index_nav clearfix phone_none">
  4. <div class="index_navTitle_box">
  5. <span class="index_nav_a_one" href="javascript:(void)" title="">{{ title }}</span>
  6. </div>
  7. <div class="index_nav_box">
  8. <span v-for="(item, index) in titleData"
  9. :class="['index_nav_a', { 'index_nav_a_only': targetSegment === item.aLIas_pinyin }]">
  10. <span v-if="index <= 20">
  11. <NuxtLink :to="{ path: `/${item.aLIas_pinyin}/list-1.html` }">{{ item.alias }}</NuxtLink>
  12. </span>
  13. </span>
  14. </div>
  15. </nav>
  16. <div class="phone_nav pc_none">
  17. <div class="phone_nav_in">
  18. <NuxtLink
  19. v-for="(item, index) in titleData" :key="index"
  20. :to="{ path: `/${item.aLIas_pinyin}/list-1.html`}" :title="item.alias"
  21. class="phone_nav_a"
  22. :target="item.is_url == 1 ? '_blank' : '_self'">
  23. {{ item.alias }}
  24. </NuxtLink>
  25. </div>
  26. </div>
  27. </div>
  28. </template>
  29. <script setup>
  30. //1.设置组件数据 start---------------------------------------->
  31. //子导航
  32. const props = defineProps({
  33. titleData: Array,
  34. pinyinid: Number
  35. });
  36. //获取当前url路径
  37. const route = useRoute();
  38. //获得当前的完整路径
  39. const fullPath = route.path;
  40. const segments = fullPath.split('/');
  41. const targetSegment = segments[1];
  42. //1.设置组件数据 end---------------------------------------->
  43. //2.设置组件标题 start ---------------------------------------->
  44. const title = ref("")
  45. async function getPageData() {
  46. const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
  47. method: 'GET',
  48. query: {
  49. 'catid': props.pinyinid,
  50. },
  51. });
  52. if (mkdata.code == 200) {
  53. title.value = mkdata.data.alias;
  54. } else {
  55. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  56. // console.log("错误位置:获取二级标题")
  57. // console.log("后端错误反馈:", mkdata.message)
  58. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  59. }
  60. }
  61. getPageData();
  62. //2.设置组件标题 end ---------------------------------------->
  63. </script>
  64. <style lang="less" scoped>
  65. .index_main {
  66. width: 1200px;
  67. margin: 0 auto;
  68. margin-bottom: 40px;
  69. }
  70. .index_nav {
  71. width: 1200px;
  72. margin: 0 auto;
  73. margin-top: 20px;
  74. border-bottom: solid 1px #D9D9D9;
  75. height: 88px;
  76. .index_navTitle_box {
  77. float: left;
  78. height: 88px;
  79. line-height: 88px;
  80. font-size: 16px;
  81. font-weight: bold;
  82. color: #333;
  83. width: 153px;
  84. // margin: 0px 30px;
  85. }
  86. .index_nav_a_one {
  87. float: left;
  88. color: #333;
  89. font-size: 16px;
  90. margin: 0px 30px;
  91. height: 88px;
  92. line-height: 88px;
  93. font-weight: bold;
  94. border-bottom: solid 3px #fff;
  95. box-sizing: border-box;
  96. position: relative;
  97. overflow: hidden;
  98. height: 56px;
  99. line-height: 56px;
  100. color: #fff;
  101. font-size: 18px;
  102. font-weight: bold;
  103. width: 153px;
  104. margin: 14px 30px 0px 0px;
  105. text-indent: 46px;
  106. background: url(https://img.bjzxtw.org.cn/master/www/nmw/img/3.png) no-repeat left top;
  107. background-size: 100% 100%;
  108. }
  109. .index_nav_box {
  110. float: left;
  111. // height: 88px;
  112. // line-height: 88px;
  113. font-size: 16px;
  114. font-weight: bold;
  115. color: #333;
  116. width: 1009px;
  117. margin-top: 15px;
  118. margin-left: 25px;
  119. }
  120. .index_nav_a {
  121. float: left;
  122. color: #333;
  123. font-size: 16px;
  124. margin: 5px 30px;
  125. font-weight: bold;
  126. border-bottom: solid 3px #fff;
  127. box-sizing: border-box;
  128. position: relative;
  129. a {
  130. color: #333333
  131. }
  132. &:hover {
  133. border-bottom: solid 3px #D2600F;
  134. }
  135. }
  136. .index_nav_a a:hover {
  137. color: #D2600F;
  138. // border-bottom: solid 3px #D2600F;
  139. }
  140. .index_nav_a_only {
  141. border-bottom: solid 3px #D2600F;
  142. }
  143. .index_nav_a::after {
  144. content: '';
  145. display: block;
  146. position: absolute;
  147. width: 2px;
  148. height: 12px;
  149. background: #DBDBDB;
  150. right: -28px;
  151. top: 6px;
  152. }
  153. // .index_nav_a:nth-last-of-type(1) {
  154. // overflow: hidden;
  155. // }
  156. // a.index_nav_a:nth-of-type(1) {
  157. // overflow: hidden;
  158. // height: 56px;
  159. // line-height: 56px;
  160. // color: #fff;
  161. // font-size: 18px;
  162. // font-weight: bold;
  163. // width: 153px;
  164. // margin: 14px 30px 0px 0px;
  165. // text-indent: 46px;
  166. // background: url(https://img.bjzxtw.org.cn/master/www/nmw/img/3.png) no-repeat left top;
  167. // background-size: 100% 100%;
  168. // }
  169. }
  170. </style>
  171. <style lang="less" scoped>
  172. @media screen and (min-width:801px){/*pc*/
  173. .pc_none{display:none;}
  174. }
  175. @media screen and (max-width:800px){/*ipad_phone*/
  176. .index_nav{width:100%;}
  177. .phone_nav{
  178. width:100%; box-sizing:border-box;background:#fafafa;
  179. margin:10px auto;height:33px;
  180. .phone_nav_in{ width:92%;margin:0px auto;
  181. overflow-x:auto;overflow-y:hidden;
  182. word-break: keep-all; white-space: nowrap;
  183. line-height:33px;
  184. height:33px;
  185. }
  186. .phone_nav_in::-webkit-scrollbar{height:0px;}
  187. .phone_nav_a{display:inline-block;line-height:33px;height:33px;
  188. color:#333;font-size:14px;margin:0px 10px;
  189. }
  190. .phone_nav_a:nth-of-type(1){margin-left:0px; }
  191. }
  192. .phone_nav_in .phone_nav_a.router-link-exact-active{
  193. color:#D2600F;
  194. }
  195. .phone_none{display:none;}
  196. }
  197. </style>