From 4ac80602e8fa371bec57a861a7c579cbd8da9250 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 4 Oct 2023 11:33:51 +0800 Subject: [PATCH] chore(Swipe): limit the decimal length of transform (#12337) --- packages/vant/src/swipe/Swipe.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/vant/src/swipe/Swipe.tsx b/packages/vant/src/swipe/Swipe.tsx index 3fd947fb1..370c87af2 100644 --- a/packages/vant/src/swipe/Swipe.tsx +++ b/packages/vant/src/swipe/Swipe.tsx @@ -123,7 +123,9 @@ export default defineComponent({ const trackStyle = computed(() => { const style: CSSProperties = { transitionDuration: `${state.swiping ? 0 : props.duration}ms`, - transform: `translate${props.vertical ? 'Y' : 'X'}(${state.offset}px)`, + transform: `translate${ + props.vertical ? 'Y' : 'X' + }(${+state.offset.toFixed(2)}px)`, }; if (size.value) {