3.vue 5.3 KB

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