2.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div class="listNewsBox">
  3. <div class="listNewsTitle">
  4. <NuxtLink v-if="titleLink.cid" :href="getLinkPath(titleLink)" :title="titleLink.alias">
  5. <div>{{ titleLink.alias }}</div>
  6. </NuxtLink>
  7. </div>
  8. <!--样式1-->
  9. <div class="listNewsContent" v-if="componentStyle == 1">
  10. <div class="photo">
  11. <div v-for="item in component_style1_News1Array_img">
  12. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  13. :target="item.islink == 1 ? '_blank' : '_self'">
  14. <img :src="item.imgurl" :alt="item.title">
  15. <span>{{ item.title }}</span>
  16. </NuxtLink>
  17. </div>
  18. </div>
  19. <div class="text" v-for="item in component_style1_News1Array_text">
  20. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  21. :target="item.islink == 1 ? '_blank' : '_self'">
  22. {{ item.title }}
  23. </NuxtLink>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script setup>
  29. //引入vue
  30. import { ref } from 'vue';
  31. //获得新闻数据
  32. const props = defineProps({
  33. titleLink: Object,//板块名称
  34. templateData: Array,//新闻数据
  35. componentStyle: Number,//样式编号
  36. });
  37. //样式1与样式2共用 start ---------------------------------------->
  38. const component_style1_News1Array_img = ref([]);
  39. const component_style1_News1Array_text = ref([]);
  40. //真实数据
  41. component_style1_News1Array_img.value = props.templateData.imgnum.slice(0, 2);
  42. component_style1_News1Array_text.value = props.templateData.textnum.slice(0, 3);
  43. //样式1与样式2共用 end ---------------------------------------->
  44. </script>
  45. <style lang="less" scoped>
  46. //基本样式 start ---------------------------------------->
  47. .listNewsBox {
  48. position: relative;
  49. .listNewsTitle {
  50. height: 38px;
  51. line-height: 38px;
  52. margin-bottom: 19px;
  53. border-bottom: 1px solid #999999;
  54. div {
  55. height: 35px;
  56. width: 138px;
  57. line-height: 32px;
  58. font-size: 22px;
  59. font-weight: bold;
  60. color: #333333;
  61. cursor: pointer;
  62. overflow: hidden;
  63. text-overflow: ellipsis;
  64. white-space: nowrap;
  65. color: #154079;
  66. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762224944805589.png") bottom left no-repeat;
  67. }
  68. }
  69. .listNewsContent {
  70. width: 100%;
  71. box-sizing: border-box;
  72. .photo {
  73. width: 378px;
  74. height: 130px;
  75. display: flex;
  76. justify-content: space-between;
  77. margin-bottom: 26px;
  78. div {
  79. position: relative;
  80. width: 185px;
  81. height: 130px;
  82. img {
  83. width: 185px;
  84. height: 130px;
  85. }
  86. span {
  87. position: absolute;
  88. bottom: 0;
  89. left: 0;
  90. display: inline-block;
  91. width: 185px;
  92. height: 29px;
  93. line-height: 29px;
  94. font-size: 14px;
  95. padding-left: 5px;
  96. box-sizing: border-box;
  97. color: #fff;
  98. background-color: #888585;
  99. overflow: hidden;
  100. text-overflow: ellipsis;
  101. white-space: nowrap;
  102. }
  103. }
  104. }
  105. .text {
  106. width: 370px;
  107. color: #666666;
  108. font-size: 18px;
  109. margin-bottom: 18px;
  110. padding-left: 16px;
  111. cursor: pointer;
  112. white-space: nowrap;
  113. overflow: hidden;
  114. text-overflow: ellipsis;
  115. a {
  116. color: #333333;
  117. }
  118. }
  119. .bg_blue {
  120. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762226842166040.png") no-repeat left center;
  121. }
  122. }
  123. }
  124. //基本样式 end ----------------------------------------></style>