1.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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" 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" 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. border-bottom: 1px solid #999999;
  63. div {
  64. height: 35px;
  65. width: 138px;
  66. line-height: 32px;
  67. font-size: 22px;
  68. font-weight: bold;
  69. color: #333333;
  70. cursor: pointer;
  71. overflow: hidden;
  72. text-overflow: ellipsis;
  73. white-space: nowrap;
  74. color: #154079;
  75. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762224944805589.png") bottom left no-repeat;
  76. }
  77. }
  78. .listNewsContent {
  79. width: 100%;
  80. box-sizing: border-box;
  81. div {
  82. width: 380px;
  83. color: #666666;
  84. font-size: 18px;
  85. margin-bottom: 18px;
  86. padding-left: 16px;
  87. cursor: pointer;
  88. overflow: hidden;
  89. text-overflow: ellipsis;
  90. white-space: nowrap;
  91. background: url("https://img.bjzxtw.org.cn/pre/image/jpeg/20251104/1762226432153586.jpg") no-repeat left center;
  92. &:first-child {
  93. height: 48px;
  94. line-height: 24px;
  95. color: #333333;
  96. font-weight: bold;
  97. }
  98. &:last-child {
  99. margin-bottom: 0;
  100. }
  101. a {
  102. color: #333333;
  103. }
  104. }
  105. .bg_blue {
  106. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762226842166040.png") no-repeat left center;
  107. }
  108. }
  109. }
  110. //基本样式 end ----------------------------------------></style>