1.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <div class="newsBox">
  3. <div class="listNewsTitle" v-if="skinId==1">
  4. 最新资讯
  5. </div>
  6. <div class="listNewsTitle_skin2" v-if="skinId==2">
  7. <span>最新资讯</span>
  8. </div>
  9. <div class="newsContent">
  10. <div v-for="item in component_style1_News1Array" class="newsContentImg">
  11. <NuxtLink
  12. :href="getLinkPathDetail(item)"
  13. :title="item.title"
  14. :target="item.islink == 1 ? '_blank' : '_self'"
  15. >
  16. <img :src="item.imgurl" />
  17. <div>{{ item.title }}</div>
  18. </NuxtLink>
  19. </div>
  20. <div v-for="item in component_style1_News2Array" class="newsContentText">
  21. <NuxtLink
  22. :href="getLinkPathDetail(item)"
  23. :title="item.title"
  24. :target="item.islink == 1 ? '_blank' : '_self'"
  25. >
  26. {{ item.title }}
  27. </NuxtLink>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script setup>
  33. //引入vue
  34. import {ref} from 'vue';
  35. //获得新闻数据
  36. const props = defineProps({
  37. templateData:Array,//新闻数据
  38. skinId:String,//皮肤id
  39. });
  40. const component_style1_News1Array = ref([]);
  41. const component_style1_News2Array = ref([]);
  42. component_style1_News1Array.value = props.templateData.img.slice(0,2);
  43. component_style1_News2Array.value = props.templateData.text.slice(0,4);
  44. </script>
  45. <style lang="less" scoped>
  46. .newsBox {
  47. .listNewsTitle {
  48. font-size:22px;
  49. font-weight:bold;
  50. height: 40px;
  51. line-height: 40px;
  52. border-bottom: 2px solid #004564;
  53. color:#004564;
  54. margin-bottom: 20px;
  55. box-sizing: border-box;
  56. }
  57. .listNewsTitle_skin2 {
  58. font-size:22px;
  59. font-weight:bold;
  60. height: 40px;
  61. line-height: 40px;
  62. border-bottom: 2px solid #A91B33;
  63. color:#A91B33;
  64. margin-bottom: 20px;
  65. box-sizing: border-box;
  66. span {
  67. color:#A91B33;
  68. height: 30px;
  69. line-height: 30px;
  70. border-left: 3px solid #A91B33;
  71. padding-left: 12px;
  72. }
  73. }
  74. .newsContent {
  75. .newsContentImg {
  76. a {
  77. display: block;
  78. display: flex;
  79. align-items: center;
  80. justify-content: center;
  81. margin-bottom: 20px;
  82. font-size:18px;
  83. div {
  84. overflow: hidden;
  85. display: -webkit-box;
  86. -webkit-line-clamp: 3;
  87. -webkit-box-orient: vertical;
  88. text-overflow: ellipsis;
  89. color:#333333;
  90. }
  91. }
  92. img {
  93. display: block;
  94. margin-right: 10px;
  95. width: 120px;
  96. height: 80px;
  97. }
  98. }
  99. .newsContentText {
  100. font-size:18px;
  101. color:#333333;
  102. margin-bottom: 20px;
  103. overflow: hidden;
  104. white-space: nowrap;
  105. text-overflow: ellipsis;
  106. a {
  107. color:#333333;
  108. }
  109. }
  110. }
  111. }
  112. </style>