1.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. border-bottom: 2px solid #004564;
  77. padding-bottom: 15px;
  78. div {
  79. font-size: 16px;
  80. font-weight: bold;
  81. width: 120px;
  82. height: 22px;
  83. line-height: 22px;
  84. a {
  85. color: #333;
  86. display: block;
  87. text-align: center;
  88. &:hover {
  89. color: #004564;
  90. }
  91. }
  92. a.active {
  93. color: #004564;
  94. }
  95. }
  96. }
  97. .channelMenuList_skin2 {
  98. display: flex;
  99. justify-content: flex-start;
  100. align-items: center;
  101. color: #333;
  102. border-bottom: 2px solid #A91B33;
  103. padding-bottom: 15px;
  104. div {
  105. font-size: 16px;
  106. font-weight: bold;
  107. width: 120px;
  108. height: 22px;
  109. line-height: 22px;
  110. a {
  111. color: #333;
  112. display: block;
  113. text-align: center;
  114. &:hover {
  115. color: #A91B33;
  116. }
  117. }
  118. a.active {
  119. color: #A91B33;
  120. }
  121. }
  122. }
  123. </style>