Commit f2be585e5ee594f9e76ba711929ff63f75b5ef48
1 parent
73772536
optimize Slider when dragging can select content in page
optimize Slider when dragging can select content in page
Showing
2 changed files
with
4 additions
and
0 deletions
Show diff stats
src/components/slider/slider.vue
| @@ -253,6 +253,7 @@ | @@ -253,6 +253,7 @@ | ||
| 253 | // for single use | 253 | // for single use |
| 254 | onSingleButtonDown (event) { | 254 | onSingleButtonDown (event) { |
| 255 | if (this.disabled) return; | 255 | if (this.disabled) return; |
| 256 | + event.preventDefault(); | ||
| 256 | this.onSingleDragStart(event); | 257 | this.onSingleDragStart(event); |
| 257 | window.addEventListener('mousemove', this.onSingleDragging); | 258 | window.addEventListener('mousemove', this.onSingleDragging); |
| 258 | window.addEventListener('mouseup', this.onSingleDragEnd); | 259 | window.addEventListener('mouseup', this.onSingleDragEnd); |
| @@ -306,6 +307,7 @@ | @@ -306,6 +307,7 @@ | ||
| 306 | // for range use first | 307 | // for range use first |
| 307 | onFirstButtonDown (event) { | 308 | onFirstButtonDown (event) { |
| 308 | if (this.disabled) return; | 309 | if (this.disabled) return; |
| 310 | + event.preventDefault(); | ||
| 309 | this.onFirstDragStart(event); | 311 | this.onFirstDragStart(event); |
| 310 | window.addEventListener('mousemove', this.onFirstDragging); | 312 | window.addEventListener('mousemove', this.onFirstDragging); |
| 311 | window.addEventListener('mouseup', this.onFirstDragEnd); | 313 | window.addEventListener('mouseup', this.onFirstDragEnd); |
| @@ -354,6 +356,7 @@ | @@ -354,6 +356,7 @@ | ||
| 354 | // for range use second | 356 | // for range use second |
| 355 | onSecondButtonDown (event) { | 357 | onSecondButtonDown (event) { |
| 356 | if (this.disabled) return; | 358 | if (this.disabled) return; |
| 359 | + event.preventDefault(); | ||
| 357 | this.onSecondDragStart(event); | 360 | this.onSecondDragStart(event); |
| 358 | window.addEventListener('mousemove', this.onSecondDragging); | 361 | window.addEventListener('mousemove', this.onSecondDragging); |
| 359 | window.addEventListener('mouseup', this.onSecondDragEnd); | 362 | window.addEventListener('mouseup', this.onSecondDragEnd); |
test/routers/slider.vue
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | <!--<Slider :step="13"></Slider>--> | 8 | <!--<Slider :step="13"></Slider>--> |
| 9 | <!--<Slider :step="13" :max="60"></Slider>--> | 9 | <!--<Slider :step="13" :max="60"></Slider>--> |
| 10 | <Icon type="checkmark-circled" size="40" color="#f60"></Icon> | 10 | <Icon type="checkmark-circled" size="40" color="#f60"></Icon> |
| 11 | + <p>附近的首付款是东方红看就是</p> | ||
| 11 | </div> | 12 | </div> |
| 12 | </template> | 13 | </template> |
| 13 | <script> | 14 | <script> |