HotNews.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <div class="hotList">
  3. <div class="title">
  4. 今日热点
  5. <em></em>
  6. </div>
  7. <div class="hotList_photo_text">
  8. <NuxtLink :to="`/newsDetail/${1}`" target="_blank">
  9. <img src="../../public/index/01.png" alt="">
  10. <span class="jingxuan">精选</span>
  11. <div class="hotlist_text">安徽黄山:雪景如画</div>
  12. </NuxtLink>
  13. </div>
  14. <ul class="message">
  15. <li class="messageList" v-for="(item, index) in 5">
  16. <NuxtLink :to="`/newsDetail/${1}`" target="_blank">
  17. 最高检:将研究出台低龄未成年人严重暴力犯罪核准追诉意见
  18. </NuxtLink>
  19. </li>
  20. </ul>
  21. </div>
  22. </template>
  23. <script setup>
  24. //获得axios
  25. const nuxtApp = useNuxtApp();
  26. const axios = nuxtApp.$axios;
  27. import { onMounted } from 'vue'
  28. const hotNewsList = ref([])
  29. //获取详情
  30. const getHotNews = async () => {
  31. const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${14}&level=${4}`);
  32. hotNewsList.value = response.data;
  33. }
  34. onMounted(() => {
  35. getHotNews()
  36. })
  37. </script>
  38. <style lang="less" scoped>
  39. .title {
  40. width: 100px;
  41. height: 40px;
  42. line-height: 40px;
  43. font-family: Microsoft YaHei, Microsoft YaHei;
  44. font-weight: 400;
  45. margin: 10px 0;
  46. font-size: 20px;
  47. color: #333333;
  48. position: relative;
  49. em {
  50. display: inline-block;
  51. width: 8px;
  52. height: 8px;
  53. border-radius: 4px;
  54. background-color: #a01c0e;
  55. position: absolute;
  56. top: 6px;
  57. right: 8px;
  58. }
  59. }
  60. .hotList_photo_text {
  61. width: 350px;
  62. height: 280px;
  63. position: relative;
  64. img {
  65. width: 350px;
  66. height: 230px;
  67. }
  68. .jingxuan {
  69. display: inline-block;
  70. width: 50px;
  71. height: 26px;
  72. background-color: #a01c0e;
  73. color: #fff;
  74. text-align: center;
  75. line-height: 26px;
  76. position: absolute;
  77. top: 0px;
  78. right: 10px;
  79. }
  80. .hotlist_text {
  81. width: 350px;
  82. height: 40px;
  83. line-height: 40px;
  84. white-space: nowrap;
  85. overflow: hidden;
  86. text-overflow: ellipsis;
  87. font-family: Microsoft YaHei, Microsoft YaHei;
  88. font-weight: bold;
  89. font-size: 18px;
  90. color: #333333;
  91. margin-top: 8px;
  92. }
  93. }
  94. .message {
  95. width: 350px;
  96. margin-top: 30px;
  97. .messageList {
  98. width: 350px;
  99. white-space: nowrap;
  100. /* 禁止换行 */
  101. overflow: hidden;
  102. /* 隐藏超出部分 */
  103. text-overflow: ellipsis;
  104. /* 超出部分显示省略号 */
  105. font-family: Microsoft YaHei, Microsoft YaHei;
  106. font-weight: 400;
  107. font-size: 18px;
  108. color: #333333;
  109. margin-bottom: 25px;
  110. a {
  111. color: #333333;
  112. }
  113. }
  114. .messageList:first-child {
  115. font-weight: bold;
  116. }
  117. >li:hover>a {
  118. color: #a01c0e;
  119. }
  120. }
  121. </style>