-
Notifications
You must be signed in to change notification settings - Fork 988
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Description
I just tried the example about autoplay in UCarousel, but with TypeScript.
<script setup lang="ts">
const props = defineProps<{
images: string[];
}>();
const carousel = useTemplateRef('carouselGallery');
onMounted(() => {
setInterval(() => {
if (!carousel.value) return;
if (carousel.value.page === carousel.value.pages) {
return carousel.value.select(0);
}
carousel.value.next();
}, 5000);
});
</script>
<template>
<UCarousel
ref="carouselGallery"
v-slot="{ item }"
:items="props.images"
:ui="{
item: 'basis-full',
indicators: { wrapper: 'bg-black/70 w-min px-2.5 py-1.5 gap-1 left-4 rounded-xl' },
}"
class="overflow-hidden"
indicators
>
<img :src="item" class="w-full" draggable="true" />
</UCarousel>
</template>And I get some TypeScript errors:
Property 'page' does not exist on type 'CreateComponentPublicInstanceWithMixins(...)
Property 'select' does not exist on type 'CreateComponentPublicInstanceWithMixins(...)
Property 'next' does not exist on type 'CreateComponentPublicInstanceWithMixins(...)
How should I correctly infer the type for UCarousel?
Nuxt v3.15.1
NuxtUI v2.20.0
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested