blog.vue 1.2 KB

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