blogs.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <script lang='ts' setup>
  2. import img01 from '@/assets/images/home_blog_img01.png'
  3. import img02 from '@/assets/images/home_blog_img02.png'
  4. import img03 from '@/assets/images/home_blog_img03.png'
  5. import {
  6. getBlogsListApi,
  7. } from '~/api/model/blogs'
  8. const list = ref<any>([])
  9. // [
  10. // {
  11. // img: img01,
  12. // title: 'The Ultimate Guide to Choosing aPerfect',
  13. // link: '',
  14. // },
  15. // {
  16. // img: img02,
  17. // title: 'The Ultimate Guide to Choosing aPerfect',
  18. // link: '',
  19. // },
  20. // {
  21. // img: img03,
  22. // title: 'The Ultimate Guide to Choosing aPerfect',
  23. // link: '',
  24. // },
  25. // ]
  26. async function getVideoOrBlogsList(pageNo = 1, pageSize = 3) {
  27. const params = {
  28. pageNo,
  29. pageSize,
  30. categoryId: '',
  31. orderBy: 'createTime',
  32. orderType: 'desc',
  33. }
  34. const res: any = await getBlogsListApi(params)
  35. list.value = res.records
  36. }
  37. getVideoOrBlogsList()
  38. </script>
  39. <template>
  40. <div class="mt-160px mb-150px text-center">
  41. <h2 class="fw-600 text-40px text-#363C40 custom-title-font">
  42. Latest Blogs
  43. </h2>
  44. <div class="mt-20px w-500px mx-auto text-#999 text-16px lh-24px">
  45. Stay informed with industry trends, product highlights, and expert tips to
  46. help you grow your business.
  47. </div>
  48. <div class="mt-60px px-75px grid grid-cols-3 gap-106px text-left">
  49. <div v-for="item, index in list" :key="index">
  50. <NuxtLink to="/register">
  51. <!-- <img :src="item.thumbnailUrl" alt="" srcset="" class="hover-effect w-352px h-352px b-rd-10px">
  52. <div class="mt-20px">
  53. <div class="mb-10px text-#666 text-14px">
  54. {{ item.contentType === '1' ? 'Blog' : 'Video' }}
  55. </div>
  56. <h3 class="!mb-10px fw-600 text-24px text-#363C40 line-clamp-2 custom-title-font">
  57. {{ item.contentTitle }}
  58. </h3>
  59. <h2 class="!mb-20px text-14px text-#999 line-clamp-2">
  60. {{ item.contentSubhead }}
  61. </h2>
  62. <div class="text-14px text-#C58C64 cursor-pointer read-more pos-relative ">
  63. Read More
  64. </div>
  65. </div> -->
  66. <common-blog-item :item="item" />
  67. </NuxtLink>
  68. </div>
  69. </div>
  70. </div>
  71. </template>
  72. <style lang='less' scoped>
  73. .read-more {
  74. &:after{
  75. position: absolute;
  76. content: "";
  77. bottom: -4px;
  78. left: 0;
  79. width: 18%;
  80. height: 2px;
  81. background: #CDA274 ;
  82. transition: height 0.3s, background 0.3s; /* 明确过渡效果 */
  83. }
  84. }
  85. </style>