4.vue 5.6 KB

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