3.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle">
  4. <NuxtLink v-if="titleLink1.cid" :href="getLinkPath(titleLink1)" :title="titleLink1.alias">
  5. <div :class="{ activeTab: activeTab == 0 }" @mouseenter="activeTab = 0">{{ titleLink1.alias }}</div>
  6. </NuxtLink>
  7. <NuxtLink v-if="titleLink2.cid" :href="getLinkPath(titleLink2)" :title="titleLink2.alias">
  8. <div :class="{ activeTab: activeTab == 1 }" @mouseenter="activeTab = 1">{{ titleLink2.alias }}</div>
  9. </NuxtLink>
  10. </div>
  11. <!--样式1-->
  12. <div class="listNewsContent" v-if="componentStyle == 1">
  13. <div v-for="item in component_style1_News1Array_1">
  14. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  15. :target="item.islink == 1 ? '_blank' : '_self'">
  16. {{ item.title }}
  17. </NuxtLink>
  18. </div>
  19. </div>
  20. <!--样式2-->
  21. <div class="listNewsContent" v-if="componentStyle == 2">
  22. <div v-for="item in component_style1_News1Array_1">
  23. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  24. :target="item.islink == 1 ? '_blank' : '_self'">
  25. {{ item.title }}
  26. </NuxtLink>
  27. </div>
  28. </div>
  29. <!--样式3-->
  30. <div class="listNewsContent" v-if="componentStyle == 3">
  31. <div v-for="item in component_style1_News1Array_1">
  32. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  33. :target="item.islink == 1 ? '_blank' : '_self'">
  34. {{ item.title }}
  35. </NuxtLink>
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script setup>
  41. //引入vue
  42. import { ref } from 'vue';
  43. //获得新闻数据
  44. const props = defineProps({
  45. titleLink1: Object,//板块1名称
  46. titleLink2: Object,//板块2名称
  47. templateData: Array,//新闻数据
  48. templateData1: Array,//新闻数据
  49. componentStyle: Number,//样式编号
  50. });
  51. //当前选中的tab
  52. const activeTab = ref(0);
  53. const component_style1_News1Array = ref([]);
  54. //真实数据
  55. component_style1_News1Array.value = props.templateData.textnum;
  56. </script>
  57. <style lang="less" scoped>
  58. //基本样式 start ---------------------------------------->
  59. .listNewsBox {
  60. position: relative;
  61. .listNewsTitle {
  62. display: flex;
  63. align-items: flex-start;
  64. justify-content: flex-start;
  65. border-bottom: 1px solid #999999;
  66. height: 38px;
  67. div {
  68. height: 35px;
  69. width: 138px;
  70. line-height: 32px;
  71. font-size: 22px;
  72. font-weight: bold;
  73. color: #333333;
  74. cursor: pointer;
  75. overflow: hidden;
  76. text-overflow: ellipsis;
  77. white-space: nowrap;
  78. &.activeTab {
  79. color: #154079;
  80. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762224944805589.png") bottom left no-repeat;
  81. }
  82. }
  83. }
  84. .listNewsContent {
  85. width: 100%;
  86. box-sizing: border-box;
  87. div {
  88. width: 380px;
  89. color: #666666;
  90. font-size: 18px;
  91. margin-bottom: 18px;
  92. padding-left: 16px;
  93. cursor: pointer;
  94. overflow: hidden;
  95. text-overflow: ellipsis;
  96. white-space: nowrap;
  97. background: url("https://img.bjzxtw.org.cn/pre/image/jpeg/20251104/1762226432153586.jpg") no-repeat left center;
  98. &:first-child {
  99. height: 48px;
  100. line-height: 24px;
  101. color: #333333;
  102. font-weight: bold;
  103. }
  104. &:last-child {
  105. margin-bottom: 0;
  106. }
  107. a {
  108. color: #333333;
  109. }
  110. }
  111. .bg_blue {
  112. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762226842166040.png") no-repeat left center;
  113. }
  114. }
  115. }
  116. //基本样式 end ----------------------------------------></style>