12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <script lang='ts' setup>
- import { Swiper, SwiperSlide } from 'swiper/vue'
- import { Navigation, Pagination } from 'swiper/modules'
- import {
- getSimilarBrandListApi,
- } from '~/api/model/brand'
- // import "swiper/css/pagination"
- import 'swiper/css'
- import 'swiper/css/navigation'
- const swiperVertical = ref<any>(null)
- const modules = [Navigation, Pagination]
- const similarBrandList = ref<any>([])
- async function getCategoryBrandList() {
- try {
- const params = {
- pageNo: 1,
- pageSize: 20,
- }
- const data: any = await getSimilarBrandListApi(params)
- similarBrandList.value = data.records
- }
- catch (error) {
- console.log('error', error)
- }
- }
- function onVerticalSwiper(swiper: any) {
- swiperVertical.value = swiper
- }
- function onClickLeft() {
- swiperVertical.value.slidePrev()
- }
- function onClickRight() {
- swiperVertical.value.slideNext()
- }
- getCategoryBrandList()
- </script>
- <template>
- <div class="w-1400px mx-auto mb-160px">
- <h2 class="!mb-60px fw-700 text-40px text-#363C40 text-center">
- Collection Brands in This Category
- </h2>
- <div class="w-1300px mx-auto pos-relative">
- <div
- 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"
- @click="onClickLeft()"
- >
- <img src="~/assets/images/arrow_left.png" alt="" class="w-26px h-26px" srcset="">
- </div>
- <div
- 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"
- @click="onClickRight()"
- >
- <img src="~/assets/images/arrow_right.png" alt="" class="w-26px h-26px" srcset="">
- </div>
- <Swiper
- v-if="similarBrandList.length"
- :slides-per-view="4" :space-between="55" :modules="modules" :loop="true" :navigation="false"
- :pagination="true" class="pos-relative" @swiper="onVerticalSwiper"
- >
- <SwiperSlide v-for="(item, index) in similarBrandList" :key="index">
- <common-brand-item :item="item" />
- </SwiperSlide>
- </Swiper>
- </div>
- <div class="flex justify-center items-center cursor-pointer mt-60px">
- <div class="underline fw-500 text-24px hover:text-#CC9879">
- View All
- </div>
- <svgo-arrow class="!w-12px !h-12px ml-14px" />
- </div>
- </div>
- </template>
- <style lang='less' scoped>
- </style>
|