blog.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <script lang='ts' setup>
  2. import { ConstKeys } from '~/enums/const-enums'
  3. import { Api } from '@/api/model/url'
  4. const list = ref<any>([])
  5. const requestUrl = `${ConstKeys.DOMAINDEV}${Api.BlogsList}`
  6. const params = { pageNo: 1, pageSize: 3, orderBy: 'createTime', orderType: 'desc' }
  7. const { data, pending, error, refresh } = await useAsyncData(
  8. 'blog-list',
  9. () => $fetch(requestUrl, { params }),
  10. )
  11. list.value = data.value?.result?.records || []
  12. </script>
  13. <template>
  14. <div
  15. v-if="list.length"
  16. class="bg-#fff py-120px data-section"
  17. data-section-color="#ffffff"
  18. >
  19. <div class="w-1200-auto text-center">
  20. <h2 class="!text-36px !fw-800 text-#333 !mb-44px custom-title-font">
  21. EJET Spark <span class="custom-title-bg03">Blog</span>
  22. </h2>
  23. <div class="flex items-center justify-end text-#9B6CFF cursor-pointer text-14px fw-bold mb-20px">
  24. View All
  25. <svgo-arrow-line-r class="w-16px h-16px ml-10px" />
  26. </div>
  27. <div class=" grid grid-cols-3 gap-40px text-left">
  28. <div v-for="item, index in list" :key="index">
  29. <common-blog-item :item="item" />
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </template>
  35. <style lang='less' scoped>
  36. </style>