1.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle">
  4. <NuxtLink
  5. v-if="titleLink.cid"
  6. :href="getLinkPath(titleLink)"
  7. :title="titleLink.alias"
  8. >
  9. {{titleLink.alias}}
  10. </NuxtLink>
  11. </div>
  12. <!--样式1-->
  13. <div class="listNewsContent" v-if="componentStyle==1">
  14. <div class="listNewsContentTop">
  15. <NuxtLink
  16. :href="getLinkPathDetail(item)"
  17. :title="item.title"
  18. :target="item.islink == 1 ? '_blank' : '_self'"
  19. v-for="item in component_style1_News1Array"
  20. >
  21. <img :src="item.imgurl" />
  22. <div class="listNewsContentTopTitle">{{ item.title }}</div>
  23. </NuxtLink>
  24. </div>
  25. <div class="listNewsContentBottom">
  26. <div v-for="item in component_style1_News2Array">
  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. <!--样式2-->
  38. <div class="listNewsContent listNewsStyle2" v-if="componentStyle==2">
  39. <div class="listNewsContentBottom">
  40. <div v-for="item in component_style1_News2Array">
  41. <NuxtLink
  42. :href="getLinkPathDetail(item)"
  43. :title="item.title"
  44. :target="item.islink == 1 ? '_blank' : '_self'"
  45. >
  46. {{ item.title }}
  47. </NuxtLink>
  48. </div>
  49. </div>
  50. <div class="listNewsContentTop">
  51. <NuxtLink
  52. :href="getLinkPathDetail(item)"
  53. :title="item.title"
  54. :target="item.islink == 1 ? '_blank' : '_self'"
  55. v-for="item in component_style1_News1Array"
  56. >
  57. <img :src="item.imgurl" />
  58. <div class="listNewsContentTopTitle">{{ item.title }}</div>
  59. </NuxtLink>
  60. </div>
  61. </div>
  62. <!-- 样式3 -->
  63. <div class="listNewsContent listNewsStyle3" v-if="componentStyle == 3">
  64. <div class="listNewsContentTop">
  65. <NuxtLink
  66. :href="getLinkPathDetail(item)"
  67. :title="item.title"
  68. :target="item.islink == 1 ? '_blank' : '_self'"
  69. v-for="item in component_style1_News1Array"
  70. >
  71. <img :src="item.imgurl" />
  72. <div class="listNewsContentTopTitle">{{ item.title }}</div>
  73. </NuxtLink>
  74. </div>
  75. <div class="listNewsContentBottom">
  76. <div v-for="item in component_style1_News2Array">
  77. <NuxtLink
  78. :href="getLinkPathDetail(item)"
  79. :title="item.title"
  80. :target="item.islink == 1 ? '_blank' : '_self'"
  81. >
  82. {{ item.title }}
  83. </NuxtLink>
  84. </div>
  85. </div>
  86. </div>
  87. <!-- 样式4 -->
  88. <div class="listNewsContent listNewsStyle4" v-if="componentStyle == 4">
  89. <div class="listNewsContentBottom">
  90. <div v-for="item in component_style1_News2Array">
  91. <NuxtLink
  92. :href="getLinkPathDetail(item)"
  93. :title="item.title"
  94. :target="item.islink == 1 ? '_blank' : '_self'"
  95. >
  96. {{ item.title }}
  97. </NuxtLink>
  98. </div>
  99. </div>
  100. <div class="listNewsContentTop">
  101. <NuxtLink
  102. :href="getLinkPathDetail(item)"
  103. :title="item.title"
  104. :target="item.islink == 1 ? '_blank' : '_self'"
  105. v-for="item in component_style1_News1Array"
  106. >
  107. <img :src="item.imgurl" />
  108. <div class="listNewsContentTopTitle">{{ item.title }}</div>
  109. </NuxtLink>
  110. </div>
  111. </div>
  112. </div>
  113. </template>
  114. <script setup>
  115. //引入vue
  116. import {ref} from 'vue';
  117. //获得新闻数据
  118. const props = defineProps({
  119. titleLink:Object,//板块名称
  120. templateData:Array,//新闻数据
  121. componentStyle:Number,//皮肤id
  122. });
  123. const component_style1_News1Array = ref([]);
  124. const component_style1_News2Array = ref([]);
  125. component_style1_News1Array.value = props.templateData.imgnum.slice(0,1);
  126. component_style1_News2Array.value = props.templateData.textnum.slice(0,3);
  127. </script>
  128. <style lang="less" scoped>
  129. //基本样式 start ---------------------------------------->
  130. .listNewsBox {
  131. position: relative;
  132. .listNewsTitle {
  133. font-size:22px;
  134. font-weight:bold;
  135. height: 40px;
  136. line-height: 40px;
  137. border-bottom: 2px solid #004564;
  138. color:#004564;
  139. margin-bottom: 20px;
  140. box-sizing: border-box;
  141. a {
  142. color:#004564;
  143. display: block;
  144. height: 25px;
  145. line-height: 25px;
  146. }
  147. }
  148. .listNewsContent {
  149. .listNewsContentTop {
  150. position: relative;
  151. width: 450px;
  152. height: 245px;
  153. margin-bottom: 17px;
  154. img {
  155. display: block;
  156. width: 450px;
  157. height: 245px;
  158. }
  159. .listNewsContentTopTitle {
  160. position: absolute;
  161. font-size: 18px;
  162. height: 44px;
  163. line-height: 44px;
  164. padding:0 10px;
  165. box-sizing: border-box;
  166. width: 100%;
  167. overflow: hidden;
  168. text-overflow: ellipsis;
  169. white-space: nowrap;
  170. bottom: 0;
  171. color:#fff;
  172. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  173. }
  174. }
  175. .listNewsContentBottom {
  176. div{
  177. height: 24px;
  178. line-height: 24px;
  179. margin-bottom: 20px;
  180. font-size: 18px;
  181. color: #333333;
  182. overflow: hidden;
  183. text-overflow: ellipsis;
  184. white-space: nowrap;
  185. a{
  186. color: #333333;
  187. }
  188. &:last-child {
  189. margin-bottom: 0;
  190. }
  191. &:first-child {
  192. font-weight: bold;
  193. }
  194. }
  195. }
  196. }
  197. }
  198. //基本样式 end ---------------------------------------->
  199. //样式2 start ---------------------------------------->
  200. .listNewsStyle2 {
  201. .listNewsContentTop {
  202. margin-bottom:0;
  203. margin-top: 17px;
  204. }
  205. }
  206. //样式2 end ---------------------------------------->
  207. //样式3
  208. .listNewsBox {
  209. .listNewsStyle3 {
  210. .listNewsContentBottom {
  211. div{
  212. &:nth-child(1) {
  213. font-weight: 400;
  214. }
  215. }
  216. }
  217. }
  218. }
  219. //样式4
  220. .listNewsBox {
  221. .listNewsStyle4 {
  222. .listNewsContentBottom {
  223. margin-bottom: 17px;
  224. div{
  225. &:nth-child(1) {
  226. font-weight: 400;
  227. }
  228. }
  229. }
  230. }
  231. }
  232. </style>