From 0ee61e72960ddc6c6549eab0940bde070e283e3f Mon Sep 17 00:00:00 2001 From: zheng yu <286915571@qq.com> Date: Tue, 13 Dec 2016 23:12:43 +0800 Subject: [PATCH] fix: fixed losing focus when drag slider button fast or right click slider button. (#1723) --- packages/slider/src/main.vue | 2 ++ packages/theme-default/src/slider.css | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/slider/src/main.vue b/packages/slider/src/main.vue index 6d7710f9..8b5ffdc3 100644 --- a/packages/slider/src/main.vue +++ b/packages/slider/src/main.vue @@ -200,6 +200,7 @@ this.setPosition(this.newPos); window.removeEventListener('mousemove', this.onDragging); window.removeEventListener('mouseup', this.onDragEnd); + window.removeEventListener('contextmenu', this.onDragEnd); } }, @@ -208,6 +209,7 @@ this.onDragStart(event); window.addEventListener('mousemove', this.onDragging); window.addEventListener('mouseup', this.onDragEnd); + window.addEventListener('contextmenu', this.onDragEnd); } }, diff --git a/packages/theme-default/src/slider.css b/packages/theme-default/src/slider.css index 5c1e9f94..9a3d0273 100644 --- a/packages/theme-default/src/slider.css +++ b/packages/theme-default/src/slider.css @@ -20,7 +20,7 @@ margin-right: 160px; width: auto; } - + &.disabled { cursor: default; @@ -79,6 +79,7 @@ transform: translateX(-50%); background-color: transparent; text-align: center; + user-select: none; .el-tooltip { line-height: 1; @@ -113,6 +114,7 @@ background-color: var(--slider-main-background-color); border-radius: 50%; transition: .2s; + user-select: none; &:hover, &.hover,