From 03aac6076ac66ba09723a6c49e9ac0e30d2e9193 Mon Sep 17 00:00:00 2001 From: halo Date: Wed, 9 Mar 2022 22:54:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20slider=20-=20=E4=BF=AE=E5=A4=8Dstep?= =?UTF-8?q?=E5=8F=82=E6=95=B0=20&=20=E4=BC=98=E5=8C=96=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/slider/StandardRange.vue | 8 +++++--- src/component/slider/VerticalRange.vue | 9 +++++---- src/component/slider/index.vue | 4 ++-- src/component/slider/utils/index.ts | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/component/slider/StandardRange.vue b/src/component/slider/StandardRange.vue index c3b172b9..5ebb2a4e 100644 --- a/src/component/slider/StandardRange.vue +++ b/src/component/slider/StandardRange.vue @@ -19,8 +19,11 @@ const props = withDefaults(defineProps(), { let rv = toRef(props, "rangeValue"); const moveAction = throttle(rangeMove); +let currbtn = -1; function handle_mousedown() { + currbtn = -1; + tooptipHide.value = false; on("selectstart", window, handle_select, { once: true }); on("mouseup", window, handle_mouseup); on("mousemove", window, moveAction); @@ -31,7 +34,6 @@ function handle_mouseup() { off("selectstart", document, handle_select); off("mouseup", window, handle_mouseup); off("mousemove", window, moveAction); - currbtn = -1; } function handle_select(e: Event): void { e.preventDefault(); @@ -39,11 +41,11 @@ function handle_select(e: Event): void { const tracker = ref(null); const emit = defineEmits(["link-val-hook"]); -let currbtn = -1; + const tooptipHide = ref(true); function rangeMove(e: MouseEvent) { - tooptipHide.value = false; + // tooptipHide.value = false; if (!tracker.value) { return; } diff --git a/src/component/slider/VerticalRange.vue b/src/component/slider/VerticalRange.vue index a1449b53..c65ef86a 100644 --- a/src/component/slider/VerticalRange.vue +++ b/src/component/slider/VerticalRange.vue @@ -20,8 +20,10 @@ const props = withDefaults(defineProps(), { let rv = toRef(props, "rangeValue"); const moveAction = throttle(rangeMove); - +let currbtn = -1; function handle_mousedown() { + currbtn = -1; + tooptipHide.value = false; on("selectstart", window, handle_select, { once: true }); on("mouseup", window, handle_mouseup); on("mousemove", window, moveAction); @@ -32,7 +34,6 @@ function handle_mouseup() { off("selectstart", document, handle_select); off("mouseup", window, handle_mouseup); off("mousemove", window, moveAction); - currbtn = -1; } function handle_select(e: Event): void { e.preventDefault(); @@ -40,11 +41,11 @@ function handle_select(e: Event): void { const tracker = ref(null); const emit = defineEmits(["link-val-hook"]); -let currbtn = -1; + const tooptipHide = ref(true); function rangeMove(e: MouseEvent) { - tooptipHide.value = false; + // tooptipHide.value = false; if (!tracker.value) { return; } diff --git a/src/component/slider/index.vue b/src/component/slider/index.vue index 9be55819..74e85342 100644 --- a/src/component/slider/index.vue +++ b/src/component/slider/index.vue @@ -41,7 +41,7 @@ function valHook(val: any) {
{ timer = null; func(args); - }, 20); + }, 30); } }; }