footer.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <script lang='ts' setup>
  2. import { Swiper, SwiperSlide } from 'swiper/vue'
  3. import { Navigation, Pagination } from 'swiper/modules'
  4. import {
  5. getSimilarBrandListApi,
  6. } from '~/api/model/brand'
  7. // import "swiper/css/pagination"
  8. import 'swiper/css'
  9. import 'swiper/css/navigation'
  10. const swiperVertical = ref<any>(null)
  11. const modules = [Navigation, Pagination]
  12. const similarBrandList = ref<any>([])
  13. async function getSimilarBrandList() {
  14. try {
  15. const params = {
  16. pageNo: 1,
  17. pageSize: 20,
  18. }
  19. const data: any = await getSimilarBrandListApi(params)
  20. similarBrandList.value = data.records
  21. }
  22. catch (error) {
  23. console.log('error', error)
  24. }
  25. }
  26. function onVerticalSwiper(swiper: any) {
  27. swiperVertical.value = swiper
  28. }
  29. function onClickLeft() {
  30. swiperVertical.value.slidePrev()
  31. }
  32. function onClickRight() {
  33. swiperVertical.value.slideNext()
  34. }
  35. getSimilarBrandList()
  36. </script>
  37. <template>
  38. <div class="w-1400px mx-auto mb-160px">
  39. <h2 class="!mb-100px fw-700 text-40px text-#333 text-center">
  40. Shop Similar Brands
  41. </h2>
  42. <div v-if="similarBrandList.length">
  43. <div class="w-1300px mx-auto pos-relative">
  44. <div
  45. class="pos-absolute cursor-pointer left--46px top-200px w-28px h-28px transform-translate-y--50% cursor-not-allowed !cursor-pointer flex justify-center items-center"
  46. @click="onClickLeft()"
  47. >
  48. <img src="~/assets/images/arrow_left.png" alt="" class="w-26px h-26px" srcset="">
  49. </div>
  50. <div
  51. class="pos-absolute cursor-pointer right--46px top-200px w-28px h-28px transform-translate-y--50% cursor-not-allowed !cursor-pointer flex justify-center items-center"
  52. @click="onClickRight()"
  53. >
  54. <img src="~/assets/images/arrow_right.png" alt="" class="w-26px h-26px" srcset="">
  55. </div>
  56. <Swiper
  57. :slides-per-view="4" :space-between="55" :modules="modules" :loop="true" :navigation="false"
  58. :pagination="true" class="pos-relative" @swiper="onVerticalSwiper"
  59. >
  60. <SwiperSlide v-for="(item, index) in similarBrandList" :key="index">
  61. <common-brand-item :item="item" />
  62. </SwiperSlide>
  63. </Swiper>
  64. </div>
  65. </div>
  66. </div>
  67. </template>
  68. <style lang='less' scoped>
  69. </style>