4.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle" v-if="skinId==1">
  4. <NuxtLink
  5. v-if="titleLink.cid"
  6. :href="getLinkPath(titleLink)"
  7. :title="titleLink.alias"
  8. >
  9. {{titleLink.alias}}
  10. </NuxtLink>
  11. </div>
  12. <div class="listNewsTitle_skin2" v-if="skinId==2">
  13. <span>
  14. <NuxtLink
  15. v-if="titleLink.cid"
  16. :href="getLinkPath(titleLink)"
  17. :title="titleLink.alias"
  18. >
  19. {{titleLink.alias}}
  20. </NuxtLink>
  21. </span>
  22. </div>
  23. <div class="listNewsContent">
  24. <div class="listNewsContentBottom">
  25. <div v-for="item in component_style1_News2Array">
  26. <NuxtLink
  27. :href="getLinkPathDetail(item)"
  28. :title="item.title"
  29. :target="item.islink == 1 ? '_blank' : '_self'"
  30. >
  31. {{ item.title }}
  32. </NuxtLink>
  33. </div>
  34. </div>
  35. <div class="listNewsContentTop">
  36. <NuxtLink
  37. :href="getLinkPathDetail(item)"
  38. :title="item.title"
  39. :target="item.islink == 1 ? '_blank' : '_self'"
  40. v-for="item in component_style1_News1Array"
  41. >
  42. <img :src="item.imgurl" />
  43. <div class="listNewsContentTopTitle">{{ item.title }}</div>
  44. </NuxtLink>
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script setup>
  50. //引入vue
  51. import {ref} from 'vue';
  52. //获得新闻数据
  53. const props = defineProps({
  54. titleLink:Object,//板块名称
  55. templateData:Array,//新闻数据
  56. skinId:String,//皮肤id
  57. });
  58. const component_style1_News1Array = ref([]);
  59. const component_style1_News2Array = ref([]);
  60. component_style1_News1Array.value = props.templateData.img.slice(0,1);
  61. component_style1_News2Array.value = props.templateData.text.slice(0,3);
  62. </script>
  63. <style lang="less" scoped>
  64. .listNewsBox {
  65. position: relative;
  66. .listNewsTitle {
  67. font-size:22px;
  68. font-weight:bold;
  69. height: 40px;
  70. line-height: 40px;
  71. border-bottom: 2px solid #004564;
  72. color:#004564;
  73. margin-bottom: 20px;
  74. box-sizing: border-box;
  75. a {
  76. color:#004564;
  77. display: block;
  78. height: 25px;
  79. line-height: 25px;
  80. }
  81. }
  82. .listNewsTitle_skin2 {
  83. font-size:22px;
  84. font-weight:bold;
  85. height: 40px;
  86. line-height: 40px;
  87. border-bottom: 2px solid #A91B33;
  88. color:#A91B33;
  89. margin-bottom: 20px;
  90. box-sizing: border-box;
  91. a {
  92. color:#A91B33;
  93. display: block;
  94. height: 25px;
  95. line-height: 25px;
  96. }
  97. span {
  98. color:#A91B33;
  99. height: 25px;
  100. line-height: 25px;
  101. border-left: 3px solid #A91B33;
  102. padding-left: 12px;
  103. display: block;
  104. }
  105. }
  106. .listNewsContent {
  107. .listNewsContentTop {
  108. position: relative;
  109. width: 450px;
  110. height: 245px;
  111. margin-top: 17px;
  112. img {
  113. display: block;
  114. width: 450px;
  115. height: 245px;
  116. }
  117. .listNewsContentTopTitle {
  118. position: absolute;
  119. font-size: 18px;
  120. height: 44px;
  121. line-height: 44px;
  122. padding:0 10px;
  123. box-sizing: border-box;
  124. width: 100%;
  125. bottom: 0;
  126. color:#fff;
  127. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  128. }
  129. }
  130. .listNewsContentBottom {
  131. height: 112px;
  132. div{
  133. height: 24px;
  134. line-height: 24px;
  135. margin-bottom: 20px;
  136. font-size: 18px;
  137. color: #333333;
  138. overflow: hidden;
  139. text-overflow: ellipsis;
  140. white-space: nowrap;
  141. a {
  142. color: #333333;
  143. }
  144. &:last-child {
  145. margin-bottom: 0;
  146. }
  147. &:first-child {
  148. font-weight: bold;
  149. }
  150. }
  151. }
  152. }
  153. }
  154. </style>