2.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <div>
  3. <div class="channelMenuTitle" v-if="skinId==1">
  4. {{title}}
  5. </div>
  6. <div class="channelMenuTitle_skin2" v-if="skinId==2">
  7. {{title}}
  8. </div>
  9. <div class="channelMenuList" v-if="skinId==1">
  10. <div v-for="item in navigateData">
  11. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">{{item.alias}}</NuxtLink>
  12. </div>
  13. </div>
  14. <div class="channelMenuList_skin2" v-if="skinId==2">
  15. <div v-for="item in navigateData">
  16. <NuxtLink :to="{path:`/${targetSegment}/${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment2 == item.aLIas_pinyin}">{{item.alias}}</NuxtLink>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script setup>
  22. //引入vue
  23. import {ref} from 'vue';
  24. //获得新闻数据
  25. const props = defineProps({
  26. skinId:String,//组件样式
  27. navigateData:Array,//子导航数据
  28. routeId:Number//导航对应的cid
  29. });
  30. //获得导航名称
  31. const title = ref("")
  32. const mkdata = await requestDataPromise('/web/getOneWebsiteCategory', {
  33. method: 'GET',
  34. query: {
  35. 'catid': props.routeId,
  36. },
  37. });
  38. if (mkdata.code == 200) {
  39. title.value = mkdata.data.alias;
  40. }
  41. //获取当前url路径
  42. const route = useRoute();
  43. //获得当前的完整路径
  44. const fullPath = route.path;
  45. const segments = fullPath.split('/');
  46. const targetSegment = segments[1];
  47. const targetSegment2 = segments[2];
  48. //判断当前为第几层的列表页
  49. // const routeLevel = ref(0);
  50. // if(route.name == "dir-list-id"){
  51. // routeLevel.value = 1;
  52. // console.log("当前的路由层级为:" + routeLevel.value);
  53. // }
  54. // if(route.name == "dir-dir-list-id"){
  55. // routeLevel.value = 2;
  56. // console.log("当前的路由层级为:" + routeLevel.value);
  57. // }
  58. </script>
  59. <style lang="less" scoped>
  60. .channelMenuTitle {
  61. width: 1200px;
  62. height: 32px;
  63. line-height: 32px;
  64. font-size: 24px;
  65. color:#1C5468;
  66. font-weight: bold;
  67. text-align: center;
  68. background: url('http://img.bjzxtw.org.cn/pre/image/jpeg/20250620/1750381219965589.jpg') no-repeat center center;
  69. margin-bottom: 25px;
  70. }
  71. .channelMenuTitle_skin2 {
  72. width: 1200px;
  73. height: 32px;
  74. line-height: 32px;
  75. font-size: 24px;
  76. color:#A91B33;
  77. font-weight: bold;
  78. text-align: center;
  79. background: url('http://img.bjzxtw.org.cn/pre/image/jpeg/20250626/1750914827434788.jpg') no-repeat center center;
  80. margin-bottom: 25px;
  81. }
  82. .channelMenuList {
  83. display: flex;
  84. justify-content: flex-start;
  85. align-items: center;
  86. color: #333;
  87. padding-bottom: 15px;
  88. div {
  89. font-size: 16px;
  90. font-weight: bold;
  91. width: 120px;
  92. height: 22px;
  93. line-height: 22px;
  94. a {
  95. color: #333;
  96. display: block;
  97. text-align: center;
  98. &:hover {
  99. color: #004564;
  100. }
  101. }
  102. a.active {
  103. color: #004564;
  104. }
  105. margin-right: 34px;
  106. &:last-child{
  107. margin-right: 0;
  108. }
  109. }
  110. }
  111. .channelMenuList_skin2 {
  112. display: flex;
  113. justify-content: flex-start;
  114. align-items: center;
  115. color: #333;
  116. border-bottom: 2px solid #A91B33;
  117. padding-bottom: 15px;
  118. div {
  119. font-size: 16px;
  120. font-weight: bold;
  121. width: 120px;
  122. height: 22px;
  123. line-height: 22px;
  124. a {
  125. color: #333;
  126. display: block;
  127. text-align: center;
  128. &:hover {
  129. color: #A91B33;
  130. }
  131. }
  132. a.active {
  133. color: #A91B33;
  134. }
  135. margin-right: 34px;
  136. &:last-child{
  137. margin-right: 0;
  138. }
  139. }
  140. }
  141. </style>