mirror of
				https://gitee.com/vant-contrib/vant-weapp.git
				synced 2025-10-27 01:42:08 +08:00 
			
		
		
		
	[bug fix]slider: 修复 value 值改变时,触发 drag 事件的问题 (#1186)
This commit is contained in:
		
							parent
							
								
									df1a90c86b
								
							
						
					
					
						commit
						b46758c92f
					
				| @ -55,7 +55,7 @@ VantComponent({ | |||||||
|       this.touchMove(event); |       this.touchMove(event); | ||||||
|       this.getRect('.van-slider').then(rect => { |       this.getRect('.van-slider').then(rect => { | ||||||
|         const diff = this.deltaX / rect.width * 100; |         const diff = this.deltaX / rect.width * 100; | ||||||
|         this.updateValue(this.startValue + diff); |         this.updateValue(this.startValue + diff, false, true); | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
| @ -73,7 +73,7 @@ VantComponent({ | |||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     updateValue(value, end) { |     updateValue(value, end, drag) { | ||||||
|       value = this.format(value); |       value = this.format(value); | ||||||
| 
 | 
 | ||||||
|       this.set({ |       this.set({ | ||||||
| @ -81,7 +81,9 @@ VantComponent({ | |||||||
|         barStyle: `width: ${value}%; height: ${this.data.barHeight};` |         barStyle: `width: ${value}%; height: ${this.data.barHeight};` | ||||||
|       }); |       }); | ||||||
| 
 | 
 | ||||||
|       this.$emit('drag', { value }); |       if (drag) { | ||||||
|  |         this.$emit('drag', { value }); | ||||||
|  |       } | ||||||
|        |        | ||||||
|       if (end) { |       if (end) { | ||||||
|         this.$emit('change', value); |         this.$emit('change', value); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user