HotNews2.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div class="hotNews">
  3. <div class="hotNews_title">
  4. 热点精选
  5. <em></em>
  6. </div>
  7. <div class="hotNews_photo_text">
  8. <div class="photo_left" v-for="(item, index) in 2">
  9. <NuxtLink :to="`/newsDetail/${1}`" target="_blank">
  10. <img src="../../public/index/01.png" alt="">
  11. <div class="hotNews_text">安徽漫山遍野的梅花竞相绽放,迎来了一年一度的梅花节。</div>
  12. </NuxtLink>
  13. </div>
  14. </div>
  15. <ul class="hotNews_message">
  16. <li class="hotNews_messageList" v-for="(item, index) in 7">
  17. <NuxtLink :to="`/newsDetail/${1}`" target="_blank">
  18. 最高检:将研究出台低龄未成年人严重暴力犯罪核准追诉意见
  19. </NuxtLink>
  20. </li>
  21. </ul>
  22. </div>
  23. </template>
  24. <script setup>
  25. //获得axios
  26. const nuxtApp = useNuxtApp();
  27. const axios = nuxtApp.$axios;
  28. import { onMounted } from 'vue'
  29. const hotNewsList = ref([])
  30. //获取详情
  31. const getHotNews = async () => {
  32. const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${5}&level=${4}&placeid=${15}`);
  33. hotNewsList.value = response.data;
  34. }
  35. onMounted(() => {
  36. getHotNews()
  37. })
  38. </script>
  39. <style lang="less" scoped>
  40. .hotNews {
  41. width: 350px;
  42. //标题
  43. .hotNews_title {
  44. width: 100px;
  45. height: 40px;
  46. line-height: 40px;
  47. font-family: Microsoft YaHei, Microsoft YaHei;
  48. font-weight: 400;
  49. margin: 20px 0;
  50. font-size: 20px;
  51. color: #333333;
  52. position: relative;
  53. em {
  54. display: inline-block;
  55. width: 8px;
  56. height: 8px;
  57. border-radius: 4px;
  58. background-color: #a01c0e;
  59. position: absolute;
  60. top: 6px;
  61. right: 8px;
  62. }
  63. }
  64. //图片文字
  65. .hotNews_photo_text {
  66. display: flex;
  67. justify-content: space-between;
  68. margin-top: 10px;
  69. img {
  70. width: 165px;
  71. height: 96px;
  72. }
  73. .hotNews_text {
  74. width: 165px;
  75. display: -webkit-box;
  76. -webkit-box-orient: vertical;
  77. -webkit-line-clamp: 2;
  78. overflow: hidden;
  79. text-overflow: ellipsis;
  80. word-break: break-all;
  81. font-family: Microsoft YaHei, Microsoft YaHei;
  82. font-weight: 400;
  83. font-size: 18px;
  84. color: #333333;
  85. margin-top: 15px;
  86. }
  87. .hotNews_text:hover {
  88. color: #a01c0e;
  89. }
  90. }
  91. //新闻列表
  92. .hotNews_message {
  93. width: 350px;
  94. margin-top: 40px;
  95. .hotNews_messageList {
  96. width: 350px;
  97. white-space: nowrap;
  98. overflow: hidden;
  99. text-overflow: ellipsis;
  100. font-family: Microsoft YaHei, Microsoft YaHei;
  101. font-weight: 400;
  102. font-size: 18px;
  103. color: #333333;
  104. margin-bottom: 30px;
  105. a {
  106. color: #333333;
  107. }
  108. }
  109. .hotNews_messageList:hover {
  110. color: #a01c0e;
  111. a {
  112. color: #a01c0e;
  113. }
  114. }
  115. }
  116. }
  117. </style>