3.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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="listNewsContentTop">
  25. <NuxtLink
  26. :href="getLinkPathDetail(item)"
  27. :title="item.title"
  28. :target="item.islink == 1 ? '_blank' : '_self'"
  29. v-for="item in component_style1_News1Array"
  30. >
  31. <img :src="item.imgurl" />
  32. <div class="listNewsContentTopTitle">{{ item.title }}</div>
  33. </NuxtLink>
  34. </div>
  35. <div class="listNewsContentBottom">
  36. <div v-for="item in component_style1_News2Array">
  37. <NuxtLink
  38. :href="getLinkPathDetail(item)"
  39. :title="item.title"
  40. :target="item.islink == 1 ? '_blank' : '_self'"
  41. >
  42. {{ item.title }}
  43. </NuxtLink>
  44. </div>
  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-bottom: 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. overflow: hidden;
  126. text-overflow: ellipsis;
  127. white-space: nowrap;
  128. bottom: 0;
  129. color:#fff;
  130. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  131. }
  132. }
  133. .listNewsContentBottom {
  134. div{
  135. height: 24px;
  136. line-height: 24px;
  137. margin-bottom: 20px;
  138. font-size: 18px;
  139. color: #333333;
  140. overflow: hidden;
  141. text-overflow: ellipsis;
  142. white-space: nowrap;
  143. a{
  144. color: #333333;
  145. }
  146. &:last-child {
  147. margin-bottom: 0;
  148. }
  149. &:first-child {
  150. font-weight: bold;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. </style>