loop images

This commit is contained in:
2023-05-20 22:02:49 +10:00
parent 9756622148
commit e62a21c469

View File

@@ -81,17 +81,25 @@ const handleModalUpdateButtons = () => {
}; };
const handleModalPrevImage = () => { const handleModalPrevImage = () => {
handleModalUpdateButtons();
if (showModalImage.value !== null) { if (showModalImage.value !== null) {
if (showModalImage.value > 0) { if (showModalImage.value > 0) {
showModalImage.value--; showModalImage.value--;
} else {
showModalImage.value = props.images.length - 1;
} }
} }
}; };
const handleModalNextImage = () => { const handleModalNextImage = () => {
handleModalUpdateButtons();
if (showModalImage.value !== null) { if (showModalImage.value !== null) {
if (showModalImage.value < props.images.length - 1) { if (showModalImage.value < props.images.length - 1) {
showModalImage.value++; showModalImage.value++;
} else {
showModalImage.value = 0;
} }
} }
}; };