2.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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:`${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment==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:`${item.aLIas_pinyin}/list-1.html`}" :class="{active:targetSegment==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. </script>
  48. <style lang="less" scoped>
  49. .channelMenuTitle {
  50. width: 1200px;
  51. height: 32px;
  52. line-height: 32px;
  53. font-size: 24px;
  54. color:#1C5468;
  55. font-weight: bold;
  56. text-align: center;
  57. background: url('http://img.bjzxtw.org.cn/pre/image/jpeg/20250620/1750381219965589.jpg') no-repeat center center;
  58. margin-bottom: 25px;
  59. }
  60. .channelMenuTitle_skin2 {
  61. width: 1200px;
  62. height: 32px;
  63. line-height: 32px;
  64. font-size: 24px;
  65. color:#A91B33;
  66. font-weight: bold;
  67. text-align: center;
  68. background: url('http://img.bjzxtw.org.cn/pre/image/jpeg/20250626/1750914827434788.jpg') no-repeat center center;
  69. margin-bottom: 25px;
  70. }
  71. .channelMenuList {
  72. display: flex;
  73. justify-content: flex-start;
  74. align-items: center;
  75. color: #333;
  76. padding-bottom: 15px;
  77. div {
  78. font-size: 16px;
  79. font-weight: bold;
  80. width: 120px;
  81. height: 22px;
  82. line-height: 22px;
  83. a {
  84. color: #333;
  85. display: block;
  86. text-align: center;
  87. &:hover {
  88. color: #004564;
  89. }
  90. }
  91. a.active {
  92. color: #004564;
  93. }
  94. }
  95. }
  96. .channelMenuList_skin2 {
  97. display: flex;
  98. justify-content: flex-start;
  99. align-items: center;
  100. color: #333;
  101. border-bottom: 2px solid #A91B33;
  102. padding-bottom: 15px;
  103. div {
  104. font-size: 16px;
  105. font-weight: bold;
  106. width: 120px;
  107. height: 22px;
  108. line-height: 22px;
  109. a {
  110. color: #333;
  111. display: block;
  112. text-align: center;
  113. &:hover {
  114. color: #A91B33;
  115. }
  116. }
  117. a.active {
  118. color: #A91B33;
  119. }
  120. }
  121. }
  122. </style>