123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <template>
- <div class="hotList">
- <div class="title">
- <h4>
- 热点资讯
- </h4>
- </div>
- <ul class="messageList">
- <li v-for="(item, index) in hotNewsList">
- <span>{{ index + 1 }}</span>
- <NuxtLink :to="`/newsDetail/${item.id}`" target="_blank">{{ item.title }}</NuxtLink>
- <!-- <NuxtLink>数说新中国75年|人民文化生活日益丰富 文...</NuxtLink> -->
- </li>
- </ul>
- </div>
- </template>
- <script setup>
- //获得axios
- const nuxtApp = useNuxtApp();
- const axios = nuxtApp.$axios;
- import { onMounted } from 'vue'
- const hotNewsList = ref([])
- //获取详情
- const getHotNews = async () => {
- const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${14}&level=${4}`);
- hotNewsList.value = response.data;
- }
- onMounted(() => {
- getHotNews()
- })
- </script>
- <style lang="less" scoped>
- .hotList {
- background: #fff;
- }
- .title {
- width: 380px;
- height: 40px;
- line-height: 40px;
- // border-top: 1px solid #139602;
- border-bottom: 1px solid #e7e7e7;
- background-color: #fbfbfb;
- >h4 {
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- margin-left: 20px;
- font-size: 20px;
- color: #000000;
- text-align: left;
- font-style: normal;
- text-transform: none;
- >span {
- float: right;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 14px;
- margin-right: 10px;
- color: #999999;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- }
- }
- .messageList {
- height: 563px;
- padding-top: 15px;
- margin-bottom: 30px;
- background-color: #fbfbfb;
- >li {
- height: 24px;
- margin-bottom: 16px;
- white-space: nowrap;
- /* 禁止换行 */
- overflow: hidden;
- /* 隐藏超出部分 */
- text-overflow: ellipsis;
- /* 超出部分显示省略号 */
- >span {
- display: inline-block;
- width: 24px;
- height: 24px;
- margin-left: 22px;
- line-height: 24px;
- vertical-align: middle;
- text-align: center;
- background-color: #cecece;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 18px;
- color: #FFFFFF;
- text-align: center;
- font-style: normal;
- text-transform: none;
- }
- >a {
- width: 256px;
- height: 21px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 16px;
- color: #333333;
- line-height: 19px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- padding-left: 10px;
- }
- }
- >li:hover>a {
- color: #139602;
- }
- >li:nth-child(1)>span {
- background-color: #00c524;
- }
- >li:nth-child(2)>span {
- background-color: #ffdf27;
- }
- >li:nth-child(3)>span {
- background-color: #f3c57f;
- }
- }
- </style>
|