1.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <div class="listNewsBox">
  3. <!-- 样式1 -->
  4. <div class="newsListSector" v-if="componentStyle == 1">
  5. <div v-for="item in listData.slice(0, 3)" class="photoText">
  6. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  7. :target="item.islink == 1 ? '_blank' : '_self'">
  8. <img src="https://img.bjzxtw.org.cn/pre/image/png/20251112/1762939232690115.png" alt="">
  9. <div class="newsListSectorRight">
  10. <span class="title">{{ item.title }}</span>
  11. <p class="desc">{{ item.introduce }}</p>
  12. <span class="time">{{ item.updated_at }}</span>
  13. </div>
  14. </NuxtLink>
  15. </div>
  16. <div v-for="item in listData.slice(3, 10)" class="text">
  17. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  18. :target="item.islink == 1 ? '_blank' : '_self'">
  19. <span class="title">{{ item.title }}</span>
  20. <p class="desc">{{ item.introduce }}</p>
  21. <span class="time">{{ item.updated_at }}</span>
  22. </NuxtLink>
  23. </div>
  24. </div>
  25. <!-- 样式2 -->
  26. <div class="newsListSector style2" v-if="componentStyle == 2">
  27. <div v-for="item in listData.slice(0, 3)" class="photoText">
  28. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  29. :target="item.islink == 1 ? '_blank' : '_self'">
  30. <img src="https://img.bjzxtw.org.cn/pre/image/png/20251112/1762939232690115.png" alt="">
  31. <div class="newsListSectorRight">
  32. <span class="title">{{ item.title }}</span>
  33. <p class="desc">{{ item.introduce }}</p>
  34. <span class="time">{{ item.updated_at }}</span>
  35. </div>
  36. </NuxtLink>
  37. </div>
  38. <div v-for="item in listData.slice(3, 10)" class="text">
  39. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  40. :target="item.islink == 1 ? '_blank' : '_self'">
  41. <span class="title">{{ item.title }}</span>
  42. <p class="desc">{{ item.introduce }}</p>
  43. <span class="time">{{ item.updated_at }}</span>
  44. </NuxtLink>
  45. </div>
  46. </div>
  47. <!-- 样式3 -->
  48. <div class="newsListSector style3" v-if="componentStyle == 3">
  49. <div v-for="item in listData.slice(0, 3)" class="photoText">
  50. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  51. :target="item.islink == 1 ? '_blank' : '_self'">
  52. <img src="https://img.bjzxtw.org.cn/pre/image/png/20251112/1762939232690115.png" alt="">
  53. <div class="newsListSectorRight">
  54. <span class="title">{{ item.title }}</span>
  55. <p class="desc">{{ item.introduce }}</p>
  56. <span class="time">{{ item.updated_at }}</span>
  57. </div>
  58. </NuxtLink>
  59. </div>
  60. <div v-for="item in listData.slice(3, 10)" class="text">
  61. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  62. :target="item.islink == 1 ? '_blank' : '_self'">
  63. <span class="title">{{ item.title }}</span>
  64. <p class="desc">{{ item.introduce }}</p>
  65. <span class="time">{{ item.updated_at }}</span>
  66. </NuxtLink>
  67. </div>
  68. </div>
  69. <!-- 样式4 -->
  70. <div class="newsListSector style4" v-if="componentStyle == 4">
  71. <div v-for="item in listData.slice(0, 3)" class="photoText">
  72. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  73. :target="item.islink == 1 ? '_blank' : '_self'">
  74. <img src="https://img.bjzxtw.org.cn/pre/image/png/20251112/1762939232690115.png" alt="">
  75. <div class="newsListSectorRight">
  76. <span class="title">{{ item.title }}</span>
  77. <p class="desc">{{ item.introduce }}</p>
  78. <span class="time">{{ item.updated_at }}</span>
  79. </div>
  80. </NuxtLink>
  81. </div>
  82. <div v-for="item in listData.slice(3, 10)" class="text">
  83. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  84. :target="item.islink == 1 ? '_blank' : '_self'">
  85. <span class="title">{{ item.title }}</span>
  86. <p class="desc">{{ item.introduce }}</p>
  87. <span class="time">{{ item.updated_at }}</span>
  88. </NuxtLink>
  89. </div>
  90. </div>
  91. </div>
  92. </template>
  93. <script setup>
  94. //引入vue
  95. import { ref } from 'vue';
  96. //获得新闻数据
  97. const props = defineProps({
  98. listData: Array,//新闻数据
  99. componentStyle: Number//组件样式
  100. });
  101. </script>
  102. <style lang="less" scoped>
  103. //基本样式 start ---------------------------------------->
  104. .listNewsBox {
  105. .newsListSector {
  106. .photoText {
  107. width: 100%;
  108. height: 180px;
  109. border-bottom: 1px dashed #cbcbcb;
  110. margin-bottom: 30px;
  111. cursor: pointer;
  112. a {
  113. display: flex;
  114. img {
  115. width: 220px;
  116. height: 160px;
  117. }
  118. .newsListSectorRight {
  119. height: 160px;
  120. padding-left: 30px;
  121. display: flex;
  122. flex-direction: column;
  123. justify-content: center;
  124. .title {
  125. display: block;
  126. width: 664px;
  127. height: 24px;
  128. line-height: 24px;
  129. white-space: nowrap;
  130. overflow: hidden;
  131. text-overflow: ellipsis;
  132. color: #333333;
  133. font-size: 23px;
  134. font-weight: bold;
  135. margin-bottom: 20px;
  136. }
  137. .desc {
  138. height: 63px;
  139. line-height: 20px;
  140. color: #666666;
  141. font-size: 18px;
  142. font-family: "Abhaya Libre", serif;
  143. margin-bottom: 20px;
  144. }
  145. .time {
  146. font-family: "Abhaya Libre", serif;
  147. font-size: 18px;
  148. color: #666666;
  149. }
  150. }
  151. }
  152. }
  153. .text {
  154. width: 100%;
  155. height: 175px;
  156. border-bottom: 1px dashed #cbcbcb;
  157. margin-bottom: 30px;
  158. cursor: pointer;
  159. a {
  160. color: #333333;
  161. .title {
  162. display: block;
  163. width: 900px;
  164. height: 24px;
  165. line-height: 24px;
  166. white-space: nowrap;
  167. overflow: hidden;
  168. text-overflow: ellipsis;
  169. color: #333333;
  170. font-size: 23px;
  171. font-weight: bold;
  172. margin-bottom: 20px;
  173. }
  174. .desc {
  175. height: 63px;
  176. line-height: 20px;
  177. color: #666666;
  178. font-size: 18px;
  179. font-family: "Abhaya Libre", serif;
  180. margin-bottom: 20px;
  181. overflow: hidden;
  182. }
  183. .time {
  184. font-family: "Abhaya Libre", serif;
  185. font-size: 18px;
  186. color: #666666;
  187. }
  188. }
  189. }
  190. }
  191. //样式2
  192. .style2 {
  193. .photoText {
  194. border-bottom: 1px solid #cbcbcb;
  195. }
  196. .text {
  197. border-bottom: 1px solid #cbcbcb;
  198. }
  199. }
  200. //样式3
  201. .style3 {
  202. .photoText {
  203. a {
  204. .newsListSectorRight {
  205. .title {
  206. font-weight: 400;
  207. }
  208. }
  209. }
  210. }
  211. .text {
  212. a {
  213. .title {
  214. font-weight: 400;
  215. }
  216. }
  217. }
  218. }
  219. //样式4
  220. .style4 {
  221. .photoText {
  222. border-bottom: 1px solid #cbcbcb;
  223. a {
  224. .newsListSectorRight {
  225. .title {
  226. font-weight: 400;
  227. }
  228. }
  229. }
  230. }
  231. .text {
  232. border-bottom: 1px solid #cbcbcb;
  233. a {
  234. .title {
  235. font-weight: 400;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. //基本样式 end ----------------------------------------></style>