Skip to content

Commit

Permalink
fix(image-viewer): 前后浏览及关闭浏览重置图片状态
Browse files Browse the repository at this point in the history
  • Loading branch information
sinbadmaster committed Aug 14, 2023
1 parent 81b4701 commit f0cd021
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/image-viewer/image-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ export default defineComponent({

const prevImage = () => {
const newIndex = indexValue.value - 1;
onRest();
setIndexValue(newIndex < 0 ? 0 : newIndex, { trigger: 'prev' });
};

const nextImage = () => {
const newIndex = indexValue.value + 1;
onRest();
setIndexValue(newIndex >= imagesList.value.length ? indexValue.value : newIndex, { trigger: 'next' });
};

Expand All @@ -90,6 +92,7 @@ export default defineComponent({
};

const openHandler = () => {
onRest();
setVisibleValue(true);
};

Expand Down

0 comments on commit f0cd021

Please sign in to comment.