hot.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <ui-page-layout title="热榜文章">
  3. <div class="pl-22rem pr-22rem">
  4. <UiMainArticle v-for="art in latestArts" :item="art"></UiMainArticle>
  5. </div>
  6. </ui-page-layout>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. banner1: [
  13. { url: "/imgs/banner1.png", title: "這裏是輪播圖推薦內容標題" },
  14. { url: "/imgs/banner1.png", title: "這裏是輪播圖推薦內容標題" },
  15. { url: "/imgs/banner1.png", title: "這裏是輪播圖推薦內容標題" },
  16. { url: "/imgs/banner1.png", title: "這裏是輪播圖推薦內容標題" },
  17. { url: "/imgs/banner1.png", title: "這裏是輪播圖推薦內容標題" },
  18. ],
  19. latestArts: [],
  20. pageIndex: 1
  21. };
  22. },
  23. methods: {
  24. async loadLatestArts(pageIndex) {
  25. let resp = await this.$http.post(this.$api.cms.articles, this.$qs.stringify(Object.assign(this.$route.query,{pageIndex: pageIndex})));
  26. if (resp.data.status === 200) {
  27. if(pageIndex === 1){
  28. this.latestArts = resp.data.data.cmsArticles;
  29. }else{
  30. this.latestArts.push(...resp.data.data.cmsArticles);
  31. }
  32. }
  33. }
  34. },
  35. async created() {
  36. this.loadLatestArts(this.pageIndex);
  37. }
  38. };
  39. </script>
  40. <style>
  41. .swiper-group {
  42. display: grid;
  43. grid-template-columns: repeat(2, 290px);
  44. grid-template-rows: repeat(2, 163px);
  45. grid-gap: 10px;
  46. }
  47. .swiper {
  48. @apply w-290px;
  49. /* align-items: end; */
  50. /* @apply w-290px h-163px; */
  51. }
  52. .swiper-title {
  53. @apply bottom-17px left-17px text-size-16px;
  54. }
  55. </style>