1.vue 4.1 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 v-for="item in component_style1_News1Array_1">
  11. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  12. :target="item.islink == 1 ? '_blank' : '_self'">
  13. {{ item.title }}
  14. </NuxtLink>
  15. </div>
  16. </div>
  17. <!--样式2-->
  18. <div class="listNewsContent style2" v-if="componentStyle == 2">
  19. <div v-for="item in component_style1_News1Array_1">
  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. <!--样式3-->
  27. <div class="listNewsContent style3" v-if="componentStyle == 3">
  28. <div v-for="item in component_style1_News1Array_1">
  29. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  30. :target="item.islink == 1 ? '_blank' : '_self'">
  31. {{ item.title }}
  32. </NuxtLink>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script setup>
  38. //引入vue
  39. import { ref } from 'vue';
  40. //获得新闻数据
  41. const props = defineProps({
  42. titleLink: Object,//板块名称
  43. templateData: Array,//新闻数据
  44. componentStyle: Number,//样式编号
  45. });
  46. //样式1与样式2共用 start ---------------------------------------->
  47. const component_style1_News1Array = ref([]);
  48. const component_style1_News1Array_1 = ref([]);
  49. //真实数据
  50. component_style1_News1Array.value = props.templateData.textnum;
  51. component_style1_News1Array_1.value = props.templateData.textnum.slice(0, 6); //第1-6条
  52. //样式1与样式2共用 end ---------------------------------------->
  53. </script>
  54. <style lang="less" scoped>
  55. //基本样式 start ---------------------------------------->
  56. .listNewsBox {
  57. position: relative;
  58. .listNewsTitle {
  59. height: 38px;
  60. line-height: 38px;
  61. margin-bottom: 19px;
  62. div {
  63. height: 35px;
  64. width: 138px;
  65. line-height: 32px;
  66. font-size: 22px;
  67. font-weight: bold;
  68. cursor: pointer;
  69. overflow: hidden;
  70. text-overflow: ellipsis;
  71. white-space: nowrap;
  72. color: #154079;
  73. padding-bottom: 5px;
  74. background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042138413493.png") bottom left no-repeat;
  75. }
  76. }
  77. .listNewsContent {
  78. width: 100%;
  79. box-sizing: border-box;
  80. div {
  81. width: 380px;
  82. color: #666666;
  83. font-size: 18px;
  84. margin-bottom: 18px;
  85. padding-left: 16px;
  86. cursor: pointer;
  87. overflow: hidden;
  88. text-overflow: ellipsis;
  89. white-space: nowrap;
  90. background: url("http://192.168.1.234:19000/pre/image/png/20251218/1766042944885873.png") no-repeat left center;
  91. &:first-child {
  92. height: 48px;
  93. line-height: 24px;
  94. color: #333333;
  95. font-weight: bold;
  96. padding-left: 0px;
  97. background: none;
  98. }
  99. &:last-child {
  100. margin-bottom: 0;
  101. }
  102. a {
  103. color: #333333;
  104. }
  105. }
  106. }
  107. .style2 {
  108. div {
  109. padding-left: 16px;
  110. background: url("http://192.168.1.234:19000/pre/image/png/20251218/176604296168575.png") no-repeat left center;
  111. &:first-child {
  112. padding-left: 0px;
  113. background: none;
  114. }
  115. }
  116. }
  117. .style3 {
  118. div {
  119. padding-left: 0px;
  120. background: none;
  121. }
  122. }
  123. }
  124. //基本样式 end ----------------------------------------></style>