TOPVERSE_Official/components/Carousel.vue

42 lines
1.3 KiB
Vue
Raw Normal View History

2023-04-26 19:45:54 +08:00
<script setup lang="ts">
2023-04-27 13:58:47 +08:00
import { useCarousel } from '~/config/pages/home/use-carousel'
const carousels = useCarousel()
2023-04-23 23:14:52 +08:00
2023-05-04 00:47:08 +08:00
const { state: pages, next, prev } = useCycleList(carousels.map((_, i) => i), {
initialValue: 0,
})
onMounted(() => {
useIntervalFn(() => {
next()
}, 3500)
})
2023-04-23 23:14:52 +08:00
</script>
<template>
<div class="relative h-500px w-full overflow-hidden md:h-600px xl:h-700px">
<AViews
v-model="pages"
h-full
class="[&>.a-views-wrapper]:h-full"
>
<AView v-for="(item, i) in carousels" :key="i" :value="i" h-full>
2023-05-30 21:13:48 +08:00
<NuxtImg :src="item.img" fit="cover" class="w-full" height="600" width="1000"/>
</AView>
</AViews>
<div class="absolute top-0 z-10 h-full w-full flex items-center justify-center text-shadow">
<Typography
2023-05-16 21:18:46 +08:00
scale-135
text-color="white"
:topic="$t(carousels[pages].title)" :description="$t(carousels[pages].description)" :link="{
...carousels[pages].link,
name: $t(carousels[pages].link.name),
}"
/>
</div>
<div class="absolute left-0 top-0 z-1 h-full w-full" style="background-image: linear-gradient(0deg,hsl(var(--a-body-bg-c)),transparent 65%, hsl(var(--a-body-bg-c))); pointer-events: none; pointer-events: none;" />
</div>
2023-04-23 23:14:52 +08:00
</template>