From 1a388229f69ab47cc8216a51010ea6aef38813f6 Mon Sep 17 00:00:00 2001 From: halo Date: Wed, 9 Mar 2022 07:28:54 +0800 Subject: [PATCH 1/3] =?UTF-8?q?refactor:=20slider=20-=20=E6=8B=86=E5=88=86?= =?UTF-8?q?index.vue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/docs/zh-CN/components/slider.md | 12 +- src/component/slider/Standard.vue | 107 ++++++++ src/component/slider/StandardRange.vue | 155 +++++++++++ src/component/slider/Vertical.vue | 112 ++++++++ src/component/slider/VerticalRange.vue | 159 +++++++++++ src/component/slider/index.less | 8 + src/component/slider/index.vue | 350 ++++++------------------ src/component/slider/utils/index.ts | 25 ++ 8 files changed, 663 insertions(+), 265 deletions(-) create mode 100644 src/component/slider/Standard.vue create mode 100644 src/component/slider/StandardRange.vue create mode 100644 src/component/slider/Vertical.vue create mode 100644 src/component/slider/VerticalRange.vue create mode 100644 src/component/slider/utils/index.ts diff --git a/example/docs/zh-CN/components/slider.md b/example/docs/zh-CN/components/slider.md index ca5d1a02..e032027b 100644 --- a/example/docs/zh-CN/components/slider.md +++ b/example/docs/zh-CN/components/slider.md @@ -13,7 +13,7 @@ ::: demo 使用 `lay-slider` 标签, 创建滑块 @@ -63,7 +63,7 @@ export default { ::: demo + + diff --git a/src/component/slider/StandardRange.vue b/src/component/slider/StandardRange.vue new file mode 100644 index 00000000..c3b172b9 --- /dev/null +++ b/src/component/slider/StandardRange.vue @@ -0,0 +1,155 @@ + + + diff --git a/src/component/slider/Vertical.vue b/src/component/slider/Vertical.vue new file mode 100644 index 00000000..ab279e4a --- /dev/null +++ b/src/component/slider/Vertical.vue @@ -0,0 +1,112 @@ + + + diff --git a/src/component/slider/VerticalRange.vue b/src/component/slider/VerticalRange.vue new file mode 100644 index 00000000..a1449b53 --- /dev/null +++ b/src/component/slider/VerticalRange.vue @@ -0,0 +1,159 @@ + + + diff --git a/src/component/slider/index.less b/src/component/slider/index.less index 2d7410e5..ffec40c4 100644 --- a/src/component/slider/index.less +++ b/src/component/slider/index.less @@ -47,6 +47,14 @@ .layui-slider-disabled { cursor: not-allowed !important; } +.layui-slider-disabled .disable-line { + background-color: #c2c2c2 !important; +} + +.layui-slider-disabled .disable-btn { + border: 2px solid #333333; +} + .layui-slider-disabled-rate { background-color: @global-primary-color !important; } diff --git a/src/component/slider/index.vue b/src/component/slider/index.vue index 10177db3..4cd41a42 100644 --- a/src/component/slider/index.vue +++ b/src/component/slider/index.vue @@ -1,5 +1,94 @@ + + - - diff --git a/src/component/slider/utils/index.ts b/src/component/slider/utils/index.ts new file mode 100644 index 00000000..c639a3f0 --- /dev/null +++ b/src/component/slider/utils/index.ts @@ -0,0 +1,25 @@ +export function sleep(wait: number) { + return new Promise((resolve) => { + setTimeout(() => { + resolve(1); + }, wait); + }); +} + +export function throttle(func: Function) { + let timer: any = null; + return function (args: any) { + if (!timer) { + timer = setTimeout(() => { + timer = null; + func(args); + }, 20); + } + }; +} + +export function handle_select(e: Event): void { + e.preventDefault(); +} + + From 89ce6c18e9bbeff2bcc00047f89de8584e5c16ed Mon Sep 17 00:00:00 2001 From: halo Date: Wed, 9 Mar 2022 07:36:38 +0800 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20slider=20-=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/slider/index.vue | 113 --------------------------------- 1 file changed, 113 deletions(-) diff --git a/src/component/slider/index.vue b/src/component/slider/index.vue index 4cd41a42..9be55819 100644 --- a/src/component/slider/index.vue +++ b/src/component/slider/index.vue @@ -14,8 +14,6 @@ export interface LaySliderProps { step?: number; disabled?: boolean; range?: boolean; - // verticalrange?: number[]; - // standardrange?: number[]; rangeValue?: number[]; } @@ -88,115 +86,4 @@ function valHook(val: any) { - From 42d8b700333baa127cc78e2fbffd402b553d4cc7 Mon Sep 17 00:00:00 2001 From: halo Date: Wed, 9 Mar 2022 07:37:29 +0800 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20slider=20-=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/slider/utils/index.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/component/slider/utils/index.ts b/src/component/slider/utils/index.ts index c639a3f0..bced3deb 100644 --- a/src/component/slider/utils/index.ts +++ b/src/component/slider/utils/index.ts @@ -1,11 +1,3 @@ -export function sleep(wait: number) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(1); - }, wait); - }); -} - export function throttle(func: Function) { let timer: any = null; return function (args: any) {