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-05-07 01:39:44 +08:00
|
|
|
onMounted(() => {
|
|
|
|
useIntervalFn(() => {
|
|
|
|
next()
|
|
|
|
}, 3500)
|
|
|
|
})
|
2023-04-23 23:14:52 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-05-07 01:39:44 +08:00
|
|
|
<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>
|
|
|
|
<img :src="item.img" style="object-fit: cover;height:100%;width: 100%;">
|
|
|
|
</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
|
2023-05-07 01:39:44 +08:00
|
|
|
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>
|