3.vue 7.9 KB

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