4.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle">
  4. <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
  5. <div>{{ titleLink.alias }}</div>
  6. </NuxtLink>
  7. </div>
  8. <!--样式1-->
  9. <div class="listNewsContent" v-if="componentStyle == 1">
  10. <div v-for="item in component_style1_News1Array_1">
  11. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  12. :target="item.islink == 1 ? '_blank' : '_self'">
  13. {{ item.title }}
  14. </NuxtLink>
  15. </div>
  16. </div>
  17. <!--样式2-->
  18. <div class="listNewsContent style2" v-if="componentStyle == 2">
  19. <div v-for="item in component_style1_News1Array_1">
  20. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  21. :target="item.islink == 1 ? '_blank' : '_self'">
  22. {{ item.title }}
  23. </NuxtLink>
  24. </div>
  25. </div>
  26. <!--样式3-->
  27. <div class="listNewsContent style3" v-if="componentStyle == 3">
  28. <div v-for="item in component_style1_News1Array_1">
  29. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  30. :target="item.islink == 1 ? '_blank' : '_self'">
  31. {{ item.title }}
  32. </NuxtLink>
  33. </div>
  34. </div>
  35. <!--样式4-->
  36. <div class="listNewsContent style4" v-if="componentStyle == 4">
  37. <div v-for="item in component_style1_News1Array_1">
  38. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  39. :target="item.islink == 1 ? '_blank' : '_self'">
  40. {{ item.title }}
  41. </NuxtLink>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script setup>
  47. //引入vue
  48. import { ref } from 'vue';
  49. //获得新闻数据
  50. const props = defineProps({
  51. titleLink: Object,//板块名称
  52. templateData: Array,//新闻数据
  53. componentStyle: Number,//样式编号
  54. });
  55. //样式1与样式2共用 start ---------------------------------------->
  56. const component_style1_News1Array = ref([]);
  57. const component_style1_News1Array_1 = ref([]);
  58. //真实数据
  59. component_style1_News1Array.value = props.templateData.textnum;
  60. component_style1_News1Array_1.value = props.templateData.textnum.slice(0, 6); //第1-6条
  61. //样式1与样式2共用 end ---------------------------------------->
  62. </script>
  63. <style lang="less" scoped>
  64. //基本样式 start ---------------------------------------->
  65. .listNewsBox {
  66. position: relative;
  67. .listNewsTitle {
  68. height: 38px;
  69. line-height: 38px;
  70. margin-bottom: 19px;
  71. div {
  72. height: 35px;
  73. width: 138px;
  74. line-height: 32px;
  75. font-size: 22px;
  76. font-weight: bold;
  77. color: #333333;
  78. cursor: pointer;
  79. overflow: hidden;
  80. text-overflow: ellipsis;
  81. white-space: nowrap;
  82. color: #154079;
  83. padding-bottom: 5px;
  84. background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042138413493.png") bottom left no-repeat;
  85. }
  86. }
  87. .listNewsContent {
  88. width: 100%;
  89. box-sizing: border-box;
  90. div {
  91. color: #666666;
  92. font-size: 18px;
  93. margin-bottom: 18px;
  94. cursor: pointer;
  95. &:first-child {
  96. height: 48px;
  97. line-height: 24px;
  98. color: #333333;
  99. font-weight: bold;
  100. width: 380px;
  101. display: -webkit-box;
  102. -webkit-box-orient: vertical;
  103. -webkit-line-clamp: 2;
  104. overflow: hidden;
  105. text-overflow: ellipsis;
  106. word-break: break-all;
  107. a {
  108. color: #333333;
  109. }
  110. }
  111. &:nth-child(2),
  112. &:nth-child(3),
  113. &:nth-child(4),
  114. &:nth-child(5),
  115. &:nth-child(6) {
  116. width: 370px;
  117. color: #666666;
  118. overflow: hidden;
  119. text-overflow: ellipsis;
  120. white-space: nowrap;
  121. padding-left: 16px;
  122. background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042944885873.png") no-repeat left center;
  123. a {
  124. color: #666666;
  125. }
  126. }
  127. &:last-child {
  128. margin-bottom: 0;
  129. }
  130. }
  131. }
  132. // 样式2
  133. .style2 {
  134. div {
  135. &:first-child {
  136. font-weight: 400;
  137. }
  138. a {
  139. color: #333333;
  140. }
  141. }
  142. }
  143. // 样式3
  144. .style3 {
  145. div {
  146. &:nth-child(2),
  147. &:nth-child(3),
  148. &:nth-child(4),
  149. &:nth-child(5),
  150. &:nth-child(6) {
  151. padding-left: 16px;
  152. background: url("http://192.168.1.234:19000/pre/image/png/20251218/176604296168575.png") no-repeat left center;
  153. a {
  154. color: #666666;
  155. }
  156. }
  157. }
  158. }
  159. //样式4
  160. .style4 {
  161. div {
  162. &:first-child {
  163. font-weight: 400;
  164. }
  165. &:nth-child(2),
  166. &:nth-child(3),
  167. &:nth-child(4),
  168. &:nth-child(5),
  169. &:nth-child(6) {
  170. padding-left: 16px;
  171. background: url("http://192.168.1.234:19000/pre/image/png/20251218/176604296168575.png") no-repeat left center;
  172. a {
  173. color: #666666;
  174. }
  175. }
  176. a {
  177. color: #333333;
  178. }
  179. }
  180. }
  181. }
  182. //基本样式 end ----------------------------------------></style>