From 7b09579d2cd7c06884c3e5ad0e5feedb8acae5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Fri, 18 Aug 2023 14:49:38 +0300 Subject: [PATCH] Fix controlled demo clicks --- doc/galleria/ControlledDoc.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/galleria/ControlledDoc.vue b/doc/galleria/ControlledDoc.vue index 5bca3253f..33a20c8ff 100644 --- a/doc/galleria/ControlledDoc.vue +++ b/doc/galleria/ControlledDoc.vue @@ -103,10 +103,10 @@ export default { }, methods: { next() { - this.activeIndex = this.activeIndex === this.images.length - 1 ? 0 : this.activeIndex + 1; + this.activeIndex = this.activeIndex === this.images.length - 1 ? this.images.length - 1 : this.activeIndex + 1; }, prev() { - this.activeIndex = this.activeIndex === 0 ? 0 : this.images.length - 1; + this.activeIndex = this.activeIndex === 0 ? 0 : this.activeIndex - 1; } } }; @@ -155,10 +155,10 @@ const responsiveOptions = ref([ ]); const next = () => { - activeIndex.value = activeIndex.value === images.value.length - 1 ? 0 : activeIndex.value + 1; + activeIndex.value = activeIndex.value === images.value.length - 1 ? images.value.length - 1 : activeIndex.value + 1; }; const prev = () => { - activeIndex.value = activeIndex.value === 0 ? 0 : images.value.length - 1; + activeIndex.value = activeIndex.value === 0 ? 0 : activeIndex.value - 1; }; <\/script>`, data: ` @@ -179,10 +179,10 @@ const prev = () => { }, methods: { next() { - this.activeIndex = this.activeIndex === this.images.length - 1 ? 0 : this.activeIndex + 1; + this.activeIndex = this.activeIndex === this.images.length - 1 ? this.images.length - 1 : this.activeIndex + 1; }, prev() { - this.activeIndex = this.activeIndex === 0 ? 0 : this.images.length - 1; + this.activeIndex = this.activeIndex === 0 ? 0 : this.activeIndex - 1; } } };