3.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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="listNewsContentTop">
  27. <div v-for="item in component_style1_News1Array" class="listNewsContentTopItem">
  28. <NuxtLink
  29. :href="getLinkPathDetail(item)"
  30. :title="item.title"
  31. :target="item.islink == 1 ? '_blank' : '_self'"
  32. >
  33. <img :src="item.imgurl" />
  34. <div class="listNewsContentTopItemTitle">{{ item.title }}</div>
  35. </NuxtLink>
  36. </div>
  37. </div>
  38. <div class="listNewsContentBottom">
  39. <div v-for="item in component_style1_News2Array" class="listNewsContentTopItem">
  40. <NuxtLink
  41. :href="getLinkPathDetail(item)"
  42. :title="item.title"
  43. :target="item.islink == 1 ? '_blank' : '_self'"
  44. >
  45. {{ item.title }}
  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. .listNewsContentTop {
  113. display: flex;
  114. align-items: center;
  115. justify-content: space-between;
  116. margin-bottom: 20px;
  117. height: 110px;
  118. .listNewsContentTopItem {
  119. width: 350px;
  120. height: 110px;
  121. a{
  122. display: block;
  123. display: flex;
  124. align-items: center;
  125. justify-content: space-between;
  126. }
  127. img {
  128. display: block;
  129. width: 170px;
  130. height: 110px;
  131. }
  132. .listNewsContentTopItemTitle {
  133. font-size: 18px;
  134. color: #333333;
  135. margin-left: 8px;
  136. margin-right: 8px;
  137. overflow: hidden;
  138. text-overflow: ellipsis;
  139. display: -webkit-box;
  140. -webkit-box-orient: vertical;
  141. -webkit-line-clamp: 3;
  142. }
  143. }
  144. }
  145. .listNewsContentBottom {
  146. display: flex;
  147. flex-wrap: wrap;
  148. align-items: flex-start;
  149. justify-content: space-between;
  150. div {
  151. width: 350px;
  152. height: 24px;
  153. line-height: 24px;
  154. overflow: hidden;
  155. text-overflow: ellipsis;
  156. white-space: nowrap;
  157. margin-bottom: 20px;
  158. &:nth-last-child(-n+2) {
  159. margin-bottom: 0;
  160. }
  161. &:nth-child(1),
  162. &:nth-child(2),
  163. &:nth-child(7),
  164. &:nth-child(8) {
  165. font-weight: bold;
  166. }
  167. a {
  168. font-size: 18px;
  169. color: #333333;
  170. }
  171. }
  172. }
  173. }
  174. }
  175. </style>