From 1a33e914b40c0456156c063d34885dcb255a03ad Mon Sep 17 00:00:00 2001 From: "dong.wang" Date: Mon, 13 Jun 2022 16:25:14 +0800 Subject: [PATCH] feat(Image): Image support mouse wheel zoom in and out --- components/vc-image/src/Preview.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/vc-image/src/Preview.tsx b/components/vc-image/src/Preview.tsx index 58ab378777..14f0415381 100644 --- a/components/vc-image/src/Preview.tsx +++ b/components/vc-image/src/Preview.tsx @@ -295,6 +295,14 @@ const Preview = defineComponent({ }, { flush: 'post', immediate: true }, ); + watch([lastWheelZoomDirection], () => { + const { wheelDirection } = lastWheelZoomDirection.value; + if (wheelDirection > 0) { + onZoomOut(); + } else if (wheelDirection < 0) { + onZoomIn(); + } + }); }); onUnmounted(() => { removeListeners();