Skip to content

Commit

Permalink
fix(image-viewer): occasionally experiences jittering when closing (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
betavs committed Sep 29, 2023
1 parent 0ec6e49 commit 9426274
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/image-viewer/image-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ export default defineComponent({

const onCloseHandle: TdImageViewerProps['onClose'] = (ctx) => {
setVisibleValue(false);

unmountContent();
window.removeEventListener('keydown', keydownHandler);

props.onClose?.(ctx);
emit('close', ctx);
};
Expand Down Expand Up @@ -150,10 +154,7 @@ export default defineComponent({
onRest();
window.addEventListener('keydown', keydownHandler);
mountContent();
return;
}
window.removeEventListener('keydown', keydownHandler);
unmountContent();
},
);

Expand Down

0 comments on commit 9426274

Please sign in to comment.