mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-10-31 03:22:08 +08:00 
			
		
		
		
	feat(ImagePreview): reset scale after swiping (#7974)
* feat(ImagePreview): reset scale after swiping * fix: should not emit scale event * fix(Calendar): watch type and reset
This commit is contained in:
		
							parent
							
								
									c532be87ff
								
							
						
					
					
						commit
						d20224a47c
					
				| @ -151,9 +151,12 @@ export default createComponent({ | |||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   watch: { |   watch: { | ||||||
|     type: 'reset', |  | ||||||
|     value: 'init', |     value: 'init', | ||||||
| 
 | 
 | ||||||
|  |     type() { | ||||||
|  |       this.reset(); | ||||||
|  |     }, | ||||||
|  | 
 | ||||||
|     defaultDate(val) { |     defaultDate(val) { | ||||||
|       this.currentDate = val; |       this.currentDate = val; | ||||||
|       this.scrollIntoView(); |       this.scrollIntoView(); | ||||||
|  | |||||||
| @ -92,6 +92,8 @@ export default { | |||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   watch: { |   watch: { | ||||||
|  |     active: 'resetScale', | ||||||
|  | 
 | ||||||
|     show(val) { |     show(val) { | ||||||
|       if (!val) { |       if (!val) { | ||||||
|         this.resetScale(); |         this.resetScale(); | ||||||
| @ -111,11 +113,15 @@ export default { | |||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     setScale(scale) { |     setScale(scale) { | ||||||
|       this.scale = range(scale, +this.minZoom, +this.maxZoom); |       scale = range(scale, +this.minZoom, +this.maxZoom); | ||||||
|  | 
 | ||||||
|  |       if (scale !== this.scale) { | ||||||
|  |         this.scale = scale; | ||||||
|         this.$emit('scale', { |         this.$emit('scale', { | ||||||
|           scale: this.scale, |           scale: this.scale, | ||||||
|           index: this.active, |           index: this.active, | ||||||
|         }); |         }); | ||||||
|  |       } | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     toggleScale() { |     toggleScale() { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user