Skip to content

Commit

Permalink
chore: more formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hroth1994 committed Sep 5, 2024
1 parent f7037ba commit d1802a0
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions es-ds-components/components/es-carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,21 @@ const props = defineProps({
},
items: {
type: Array,
default: [],
default: () => [],
required: true,
},
});
const autoplayInterval = ref(props.autoscroll ? 3000 : 0);
const key = ref('');
const stopAutoplay = () => {
if (props.autoscroll) {
autoplayInterval.value = 0;
key.value = 'stopAutoplay';
}
};
onMounted(() => {
document.addEventListener('keyup', (e) => {
if (e.key === 'Escape') {
Expand All @@ -57,22 +64,16 @@ onMounted(() => {
});
});
const stopAutoplay = () => {
if (props.autoscroll) {
autoplayInterval.value = 0;
key.value = 'stopAutoplay';
}
};
</script>

<template>
<Carousel
<carousel
:key="key"
:autoplayInterval="autoplayInterval"
:autoplay-interval="autoplayInterval"
circular
:num-visible="4"
:responsiveOptions="responsiveOptions"
:showIndicators="dots"
:responsive-options="responsiveOptions"
:show-indicators="dots"
:value="items"
:pt="{
container: {
Expand Down Expand Up @@ -109,7 +110,7 @@ const stopAutoplay = () => {
name="item"
:item="item.data" />
</template>
</Carousel>
</carousel>
</template>

<style lang="scss" scoped>
Expand Down

0 comments on commit d1802a0

Please sign in to comment.