4.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle_skin4">
  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_skin4 {
  135. font-size:22px;
  136. font-weight:bold;
  137. height: 40px;
  138. line-height: 40px;
  139. border-bottom: 1px solid #fe8f00;
  140. margin-bottom: 20px;
  141. box-sizing: border-box;
  142. span {
  143. display: inline-block;
  144. width: 112px;
  145. height: 40px;
  146. line-height: 40px;
  147. background: #fe8f00;
  148. border-top-left-radius: 4px;
  149. border-top-right-radius: 4px;
  150. color:#fff;
  151. text-align: center;
  152. a{
  153. color: #fff;
  154. }
  155. }
  156. }
  157. .listNewsContent {
  158. .listNewsContentTop {
  159. position: relative;
  160. width: 450px;
  161. height: 245px;
  162. margin-bottom: 17px;
  163. img {
  164. display: block;
  165. width: 450px;
  166. height: 245px;
  167. }
  168. .listNewsContentTopTitle {
  169. position: absolute;
  170. font-size: 18px;
  171. height: 44px;
  172. line-height: 44px;
  173. padding:0 10px;
  174. box-sizing: border-box;
  175. width: 100%;
  176. overflow: hidden;
  177. text-overflow: ellipsis;
  178. white-space: nowrap;
  179. bottom: 0;
  180. color:#fff;
  181. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  182. }
  183. }
  184. .listNewsContentBottom {
  185. height: 112px;
  186. div{
  187. height: 24px;
  188. line-height: 24px;
  189. margin-bottom: 20px;
  190. font-size: 18px;
  191. color: #333333;
  192. overflow: hidden;
  193. text-overflow: ellipsis;
  194. white-space: nowrap;
  195. a {
  196. color: #333333;
  197. }
  198. &:last-child {
  199. margin-bottom: 0;
  200. }
  201. &:first-child {
  202. font-weight: bold;
  203. }
  204. }
  205. }
  206. }
  207. }
  208. //基本样式 end ---------------------------------------->
  209. //样式2 start ---------------------------------------->
  210. .listNewsStyle2 {
  211. .listNewsContentTop {
  212. margin-bottom:0;
  213. margin-top: 17px;
  214. }
  215. }
  216. //样式2 end ---------------------------------------->
  217. //样式3
  218. .listNewsBox {
  219. .listNewsStyle3 {
  220. .listNewsContentBottom {
  221. div{
  222. &:nth-child(1) {
  223. font-weight: 400;
  224. }
  225. }
  226. }
  227. }
  228. }
  229. //样式4
  230. .listNewsBox {
  231. .listNewsStyle4 {
  232. .listNewsContentBottom {
  233. margin-bottom: 17px;
  234. div{
  235. &:nth-child(1) {
  236. font-weight: 400;
  237. }
  238. }
  239. }
  240. }
  241. }
  242. </style>