4.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle" v-if="skinId=='1'">
  4. <NuxtLink
  5. class="active"
  6. v-if="titleLink.cid"
  7. :href="getLinkPath(titleLink)"
  8. :title="titleLink.alias"
  9. >
  10. {{titleLink.alias}}
  11. </NuxtLink>
  12. </div>
  13. <div class="listNewsTitle_skin2" v-if="skinId=='2'">
  14. <span>
  15. <NuxtLink
  16. class="active"
  17. v-if="titleLink.cid"
  18. :href="getLinkPath(titleLink)"
  19. :title="titleLink.alias"
  20. >
  21. {{titleLink.alias}}
  22. </NuxtLink>
  23. </span>
  24. </div>
  25. <div class="listNewsContent">
  26. <div class="listNewsContentBottomBox">
  27. <div class="listNewsContentBottom">
  28. <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
  29. <NuxtLink
  30. :href="getLinkPathDetail(item)"
  31. :title="item.title"
  32. :target="item.islink == 1 ? '_blank' : '_self'"
  33. >
  34. {{ item.title }}
  35. </NuxtLink>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="listNewsContentTop">
  40. <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
  41. <NuxtLink
  42. :href="getLinkPathDetail(item)"
  43. :title="item.title"
  44. :target="item.islink == 1 ? '_blank' : '_self'"
  45. >
  46. <img :src="item.imgurl" />
  47. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  48. </NuxtLink>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </template>
  54. <script setup>
  55. //引入vue
  56. import {ref} from 'vue';
  57. //获得新闻数据
  58. const props = defineProps({
  59. titleLink:Object,//板块名称
  60. templateData:Array,//新闻数据
  61. skinId:String,//皮肤id
  62. });
  63. //样式1与样式2共用 start ---------------------------------------->
  64. const component_style1_News1Array = ref({});
  65. const component_style1_News2Array = ref([]);
  66. component_style1_News1Array.value = props.templateData.img.slice(0,2);
  67. component_style1_News2Array.value = props.templateData.text;
  68. //样式1与样式2共用 end ---------------------------------------->
  69. </script>
  70. <style lang="less" scoped>
  71. .listNewsBox {
  72. position: relative;
  73. .listNewsTitle {
  74. font-size:22px;
  75. font-weight:bold;
  76. height: 40px;
  77. line-height: 40px;
  78. border-bottom: 2px solid #004564;
  79. color:#004564;
  80. margin-bottom: 20px;
  81. box-sizing: border-box;
  82. a {
  83. color:#004564;
  84. display: block;
  85. height: 25px;
  86. line-height: 25px;
  87. }
  88. }
  89. .listNewsTitle_skin2 {
  90. font-size:22px;
  91. font-weight:bold;
  92. height: 40px;
  93. line-height: 40px;
  94. border-bottom: 2px solid #A91B33;
  95. color:#A91B33;
  96. margin-bottom: 20px;
  97. box-sizing: border-box;
  98. a {
  99. color:#A91B33;
  100. display: block;
  101. height: 25px;
  102. line-height: 25px;
  103. }
  104. span {
  105. color:#A91B33;
  106. height: 25px;
  107. line-height: 25px;
  108. border-left: 3px solid #A91B33;
  109. padding-left: 12px;
  110. display: block;
  111. }
  112. }
  113. .listNewsContent {
  114. height: 374px;
  115. .listNewsContentTop {
  116. display: flex;
  117. align-items: center;
  118. justify-content: space-between;
  119. .listNewsContentTopItem {
  120. width: 350px;
  121. height: 110px;
  122. a{
  123. display: block;
  124. display: flex;
  125. align-items: center;
  126. justify-content: space-between;
  127. }
  128. img {
  129. display: block;
  130. width: 170px;
  131. height: 110px;
  132. }
  133. .listNewsContentTopItemTitle {
  134. font-size: 18px;
  135. color: #333333;
  136. margin-left: 8px;
  137. margin-right: 8px;
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. display: -webkit-box;
  141. -webkit-box-orient: vertical;
  142. -webkit-line-clamp: 3;
  143. }
  144. }
  145. }
  146. .listNewsContentBottomBox {
  147. height: 244px;
  148. margin-bottom: 20px;
  149. }
  150. .listNewsContentBottom {
  151. display: flex;
  152. flex-wrap: wrap;
  153. align-items: flex-start;
  154. justify-content: space-between;
  155. margin-bottom: 20px;
  156. div {
  157. width: 350px;
  158. height: 24px;
  159. line-height: 24px;
  160. overflow: hidden;
  161. text-overflow: ellipsis;
  162. white-space: nowrap;
  163. margin-bottom: 20px;
  164. &:nth-last-child(-n+2) {
  165. margin-bottom: 0;
  166. }
  167. &:nth-child(1),
  168. &:nth-child(2),
  169. &:nth-child(7),
  170. &:nth-child(8) {
  171. font-weight: bold;
  172. }
  173. a {
  174. font-size: 18px;
  175. color: #333333;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. </style>