1.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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="">
  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. div {
  54. height: 35px;
  55. width: 138px;
  56. line-height: 32px;
  57. font-size: 22px;
  58. font-weight: bold;
  59. color: #333333;
  60. cursor: pointer;
  61. overflow: hidden;
  62. text-overflow: ellipsis;
  63. white-space: nowrap;
  64. color: #154079;
  65. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762224944805589.png") bottom left no-repeat;
  66. }
  67. }
  68. .listNewsContent {
  69. width: 100%;
  70. box-sizing: border-box;
  71. .photo {
  72. width: 378px;
  73. height: 130px;
  74. display: flex;
  75. justify-content: space-between;
  76. margin-bottom: 26px;
  77. div {
  78. position: relative;
  79. width: 185px;
  80. height: 130px;
  81. img {
  82. width: 185px;
  83. height: 130px;
  84. }
  85. span {
  86. position: absolute;
  87. bottom: 0;
  88. left: 0;
  89. display: inline-block;
  90. width: 185px;
  91. height: 29px;
  92. line-height: 29px;
  93. font-size: 14px;
  94. padding-left: 5px;
  95. box-sizing: border-box;
  96. color: #fff;
  97. background-color: #888585;
  98. overflow: hidden;
  99. text-overflow: ellipsis;
  100. white-space: nowrap;
  101. }
  102. }
  103. }
  104. .text {
  105. width: 370px;
  106. color: #666666;
  107. font-size: 18px;
  108. margin-bottom: 18px;
  109. padding-left: 16px;
  110. cursor: pointer;
  111. white-space: nowrap;
  112. overflow: hidden;
  113. text-overflow: ellipsis;
  114. a {
  115. color: #333333;
  116. }
  117. }
  118. .bg_blue {
  119. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762226842166040.png") no-repeat left center;
  120. }
  121. }
  122. }
  123. //基本样式 end ----------------------------------------></style>