mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-10-27 01:32:10 +08:00 
			
		
		
		
	feat(Sticky): add change event (#8479)
This commit is contained in:
		
							parent
							
								
									fd3f02cb5a
								
							
						
					
					
						commit
						00c01d0920
					
				| @ -62,9 +62,10 @@ export default { | ||||
| 
 | ||||
| ### Events | ||||
| 
 | ||||
| | Event  | Description            | Arguments                      | | ||||
| | ------ | ---------------------- | ------------------------------ | | ||||
| | scroll | Emitted when scrolling | object: { scrollTop, isFixed } | | ||||
| | Event | Description | Arguments | | ||||
| | --- | --- | --- | | ||||
| | change `v2.12.13` | Emitted when sticky status changed | _isFixed: boolean_ | | ||||
| | scroll | Emitted when scrolling | _{ scrollTop: number, isFixed: boolean }_ | | ||||
| 
 | ||||
| ### Less Variables | ||||
| 
 | ||||
|  | ||||
| @ -72,9 +72,10 @@ export default { | ||||
| 
 | ||||
| ### Events | ||||
| 
 | ||||
| | 事件名 | 说明       | 回调参数                                       | | ||||
| | ------ | ---------- | ---------------------------------------------- | | ||||
| | scroll | 滚动时触发 | { scrollTop: 距离顶部位置, isFixed: 是否吸顶 } | | ||||
| | 事件名 | 说明 | 回调参数 | | ||||
| | --- | --- | --- | | ||||
| | change `v2.12.13` | 当吸顶状态改变时触发 | _isFixed: boolean_ | | ||||
| | scroll | 滚动时触发 | _{ scrollTop: number, isFixed: boolean }_ | | ||||
| 
 | ||||
| ### 样式变量 | ||||
| 
 | ||||
|  | ||||
| @ -68,6 +68,12 @@ export default createComponent({ | ||||
|     }, | ||||
|   }, | ||||
| 
 | ||||
|   watch: { | ||||
|     fixed(isFixed) { | ||||
|       this.$emit('change', isFixed); | ||||
|     }, | ||||
|   }, | ||||
| 
 | ||||
|   created() { | ||||
|     // compatibility: https://caniuse.com/#feat=intersectionobserver
 | ||||
|     if (!isServer && window.IntersectionObserver) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user