123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <!-- @format -->
- <script lang="ts" setup>
- import { Swiper, SwiperSlide } from 'swiper/vue'
- import { Navigation, Pagination } from 'swiper/modules'
- import 'swiper/css'
- import 'swiper/css/navigation'
- import { ConstKeys } from '~/enums/const-enums'
- const modules = [Navigation, Pagination]
- const categoryList = ref<any>([])
- const swiperVertical = ref<any>(null)
- const router = useRouter()
- const solution = ref('category')
- const list = ref([
- {
- key: 'category',
- title: 'By Category',
- },
- {
- key: 'trend',
- title: 'By Trend',
- },
- ])
- const { data, pending, error, refresh } = await useAsyncData(
- 'brand-detail',
- () => $fetch(`${ConstKeys.DOMAINPRO}/client/brand/list/default`, { params: { pageNo: 1, pageSize: 8 } }),
- )
- categoryList.value = data.value?.result.records
- function onVerticalSwiper(swiper: any) {
- swiperVertical.value = swiper
- }
- function onClickLeft() {
- // swiperVertical.value.slideTo()
- swiperVertical.value.slidePrev()
- }
- function onClickRight() {
- // swiperVertical.value.slideTo(4)
- swiperVertical.value.slideNext()
- }
- function onViewAll() {
- if (solution.value === 'category')
- router.push({ path: '/categories' })
- else
- router.push({ path: '/trends' })
- }
- </script>
- <template>
- <div
- id="catalogs" class="bg-#0F0820 pt-100px pb-160px data-section"
- data-section-color="#0F0820"
- >
- <div class="w-1200-auto text-left pos-relative">
- <h2 class="text-36px fw-800 text-#fff !mb-40px custom-title-font">
- Download EJET Spark <span class="custom-title-bg02">Catalogs</span>
- </h2>
- <div class="flex gap-20px mb-30px text-center">
- <div
- v-for="(item, index) in list"
- :key="index"
- class="py-8px w-132px b-rd-6px text-14px fw-bold b-solid b-1px cursor-pointer hover:bg-#fff hover:text-#000 transition-all duration-300"
- :class="
- solution === item.key
- ? '!bg-#fff !text-#000 b-#fff'
- : 'bg-#0F0820 text-#fff b-#fff'
- "
- @click="solution = item.key"
- >
- <div>{{ item.title }}</div>
- </div>
- </div>
- <div class="w-1200-auto pos-relative">
- <div class="flex items-center justify-end text-#fff text-14px fw-bold mb-20px cursor-pointer" @click="onViewAll()">
- View All
- <svgo-arrow-line-r class="w-16px h-16px ml-10px" />
- </div>
- <div
- class="pos-absolute cursor-pointer left-48% bottom--60px w-30px h-30px transform-translate-x--50% cursor-not-allowed !cursor-pointer flex justify-center items-center"
- @click="onClickLeft()"
- >
- <img
- src="~/assets/images/swiper_icon2_l.png"
- alt=""
- class="!w-2430px !h-30px"
- srcset=""
- >
- </div>
- <div
- class="pos-absolute cursor-pointer left-52% bottom--60px w-28px h-28px transform-translate-x--50% cursor-not-allowed !cursor-pointer flex justify-center items-center"
- @click="onClickRight()"
- >
- <img
- src="~/assets/images/swiper_icon2_r.png"
- alt=""
- class="!w-30px !h-30px"
- srcset=""
- >
- </div>
- <Swiper
- v-if="categoryList.length"
- :slides-per-view="3"
- :space-between="20"
- :modules="modules"
- :centered-slides="true"
- :loop="true"
- :navigation="false"
- :pagination="true"
- class="pos-relative"
- @set-translate="setTranslate"
- @swiper="onVerticalSwiper"
- >
- <SwiperSlide v-for="(item, index) in categoryList" :key="index">
- <common-catalogs-item :item="item" class="catalog-item" />
- </SwiperSlide>
- </Swiper>
- </div>
- <img
- class="w-240px h-148px pos-absolute right-0 bottom--160px z-101"
- src="~/assets/images/catalogs_img01.png"
- alt=""
- >
- </div>
- </div>
- </template>
- <style lang="less" scoped>
- .swiper-slide{
- border-radius: 10px;
- background-color: #fff;
- }
-
- .swiper-slide{
- background-color: #F3F4FB;
- &.swiper-slide-prev{
- background-color: #D7C4FF!important;
- transition: all 0.3s ease-in-out;
- }
- }
- </style>
|