Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/content/1.getting-started/2.usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ import { SplitPanel } from '@directus/vue-split-panel';
::
::

### Emits
::field-group
::field{name="transitionend" type="() => void"}
The event triggered when the transition end.
::
::

## Examples

### % / Pixels
Expand Down
9 changes: 8 additions & 1 deletion packages/vue-split-panel/src/SplitPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ const props = withDefaults(defineProps<SplitPanelProps>(), {
snapThreshold: 12,
});

const emits = defineEmits<{
transitionend: [];
}>();

const panelEl = useTemplateRef('split-panel');
const dividerEl = useTemplateRef('divider');

Expand Down Expand Up @@ -96,7 +100,10 @@ const collapsed = defineModel<boolean>('collapsed', { default: false });

const collapseTransitionState = ref<null | 'expanding' | 'collapsing'>(null);

const onTransitionEnd = () => collapseTransitionState.value = null;
const onTransitionEnd = () => {
collapseTransitionState.value = null;
emits('transitionend');
};

watch(collapsed, (newCollapsed) => {
if (newCollapsed === true) {
Expand Down