2.vue 7.9 KB

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