File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed
packages/vue-spring-bottom-sheet/src Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ Assuming there is `const bottomSheet = ref()`
162162| dragging-up | Emitted when user drags sheet upward | - |
163163| dragging-down | Emitted when user drags sheet downward | - |
164164| instinctHeight | Emitted when content height changes | height (number) |
165+ | snapped | Emitted when sheet finishes snapping | snapPointIndex (number) |
165166
166167## Acknowledgments
167168
Original file line number Diff line number Diff line change 2323 },
2424 "packages/vue-spring-bottom-sheet" : {
2525 "name" : " @douxcode/vue-spring-bottom-sheet" ,
26- "version" : " 2.0.4 " ,
26+ "version" : " 2.1.0 " ,
2727 "dependencies" : {
2828 "@vueuse/core" : " ^13.0.0" ,
2929 "@vueuse/integrations" : " ^13.0.0" ,
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ const emit = defineEmits<{
2626 (e : ' ready' ): void
2727 (e : ' dragging-up' ): void
2828 (e : ' dragging-down' ): void
29+ (e : ' snapped' , snapPointIndex ? : number ): void
2930 (e : ' instinctHeight' , instinctHeight : number ): void
3031 (e : ' update:modelValue' ): void
3132}>()
@@ -243,6 +244,7 @@ const snapToPoint = (index: number) => {
243244 controls = animate (heightValue , height .value , {
244245 duration: props .duration / 1000 ,
245246 ease: ' easeInOut' ,
247+ onComplete : () => emit (' snapped' , snapPointsRef .value .indexOf (snapPointsRef .value [index ])),
246248 })
247249}
248250
@@ -332,6 +334,11 @@ const handlePanEnd = () => {
332334 controls = animate (heightValue , height .value , {
333335 duration: props .duration / 1000 ,
334336 ease: ' easeInOut' ,
337+ onComplete : () =>
338+ emit (
339+ ' snapped' ,
340+ snapPointsRef .value .indexOf (snapPointsRef .value [closestSnapPointIndex .value ]),
341+ ),
335342 })
336343 controls = animate (translateYValue , 0 , {
337344 duration: props .duration / 1000 ,
You can’t perform that action at this time.
0 commit comments