From 002de9dd9e68be3edec1ea52274f458fee98ce69 Mon Sep 17 00:00:00 2001
From: wang <825251234@qq.com>
Date: Fri, 17 Dec 2021 20:52:45 +0800
Subject: [PATCH] =?UTF-8?q?slider=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
example/docs/zh-CN/components/slider.md | 12 +-
src/module/slider/index.less | 134 ++++++++++++++++-----
src/module/slider/index.vue | 153 ++++++++++++++++--------
3 files changed, 210 insertions(+), 89 deletions(-)
diff --git a/example/docs/zh-CN/components/slider.md b/example/docs/zh-CN/components/slider.md
index 29310cc7..9dfcd472 100644
--- a/example/docs/zh-CN/components/slider.md
+++ b/example/docs/zh-CN/components/slider.md
@@ -1,7 +1,7 @@
::: demo
-
+
\ No newline at end of file
+const standardMove = (e: MouseEvent) => {
+ if (!standardtracker.value) {
+ return;
+ }
+ let tracker_rect = standardtracker.value.getBoundingClientRect();
+ let origin_left = tracker_rect.left;
+ let point_left = e.clientX;
+ let distance = point_left - origin_left;
+ if (distance < 0) {
+ standard_style.left = 0;
+ standard_style.width = 0;
+ } else {
+ let rate = (distance / tracker_rect.width) * 100;
+ standard_style.left = Math.floor(rate);
+ standard_style.width = Math.floor(rate);
+ if (standard_style.left > 100) {
+ standard_style.left = 100;
+ standard_style.width = 100;
+ // props.modelValue = 100;
+ }
+ }
+ emit("update:modelValue", standard_style.left);
+};
+const verticalMove = (e: MouseEvent) => {
+ if (!verticaltracker.value) {
+ return;
+ }
+ let tracker_rect = verticaltracker.value.getBoundingClientRect();
+ let origin_bottom = tracker_rect.bottom;
+ let point_bottom = e.clientY;
+ let distance = (point_bottom - origin_bottom) * -1
+ if (distance < 0) {
+ vertical_style.bottom = 0;
+ vertical_style.height = 0;
+ } else {
+ let rate = (distance / tracker_rect.height) * 100;
+ console.log(rate)
+ vertical_style.bottom = Math.floor(rate);
+ vertical_style.height = Math.floor(rate);
+ if (vertical_style.bottom > 100) {
+ vertical_style.bottom = 100;
+ vertical_style.height = 100;
+ // props.modelValue = 100;
+ }
+ }
+ emit("update:modelValue", vertical_style.bottom);
+};
+