TOPVERSE_Official/components/Carousel.vue

45 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,
})
2023-04-26 19:45:54 +08:00
useIntervalFn(() => {
next()
}, 2500)
2023-04-23 23:14:52 +08:00
</script>
<template>
2023-04-26 19:45:54 +08:00
<AViews
v-model="pages"
2023-04-23 23:14:52 +08:00
>
2023-04-26 19:45:54 +08:00
<AView v-for="(item, i) in carousels" :key="i" :value="i">
<div class="relative h-full max-h-700px min-h-500px w-full flex items-center justify-center bg-transparent">
2023-05-04 00:47:08 +08:00
<div class="absolute absolute z-10 hidden text-shadow">
<h2 class="text-h2 text-start text-amber-700 dark:text-white">
2023-04-26 19:45:54 +08:00
{{ $t(item.title) }}
</h2>
<p class="text-h3 text-start">
{{ $t(item.description) }}
</p>
2023-05-04 00:47:08 +08:00
<NuxtLink :href="item.link.href">
<ABtn class="text-xl">
{{ $t(item.link.name) }}
</ABtn>
</NuxtLink>
2023-04-26 19:45:54 +08:00
</div>
2023-05-04 00:47:08 +08:00
<div class="absolute left-0 top-0 h-full w-full" style="background-image: linear-gradient(0deg,hsl(var(--a-body-bg-c)),transparent 65%, hsl(var(--a-body-bg-c)));" />
2023-04-27 13:58:47 +08:00
<img :src="item.img">
2023-04-26 19:45:54 +08:00
</div>
<!-- <ACard
:title="item.title"
class="h-300px shadow-none"
:text="item.description"
/> -->
</AView>
</AViews>
2023-04-23 23:14:52 +08:00
</template>