Skip to content

Commit b84e807

Browse files
feat: Add the transitionend event to enhance the interactivity of the component. (#24)
Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
1 parent 84a4514 commit b84e807

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

docs/content/1.getting-started/2.usage.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ import { SplitPanel } from '@directus/vue-split-panel';
123123
::
124124
::
125125

126+
### Emits
127+
::field-group
128+
::field{name="transitionend" type="() => void"}
129+
The event triggered when the transition end.
130+
::
131+
::
132+
126133
## Examples
127134

128135
### % / Pixels

packages/vue-split-panel/src/SplitPanel.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ const props = withDefaults(defineProps<SplitPanelProps>(), {
2121
snapThreshold: 12,
2222
});
2323
24+
const emits = defineEmits<{
25+
transitionend: [];
26+
}>();
27+
2428
const panelEl = useTemplateRef('split-panel');
2529
const dividerEl = useTemplateRef('divider');
2630
@@ -96,7 +100,10 @@ const collapsed = defineModel<boolean>('collapsed', { default: false });
96100
97101
const collapseTransitionState = ref<null | 'expanding' | 'collapsing'>(null);
98102
99-
const onTransitionEnd = () => collapseTransitionState.value = null;
103+
const onTransitionEnd = () => {
104+
collapseTransitionState.value = null;
105+
emits('transitionend');
106+
};
100107
101108
watch(collapsed, (newCollapsed) => {
102109
if (newCollapsed === true) {

0 commit comments

Comments
 (0)