Merge pull request #6838 from sivareddyuppathi/drawer-add-before

Drawer: Add before-hide event to Drawer component
pull/7055/head
Tuğçe Küçükoğlu 2025-01-07 14:14:49 +03:00 committed by GitHub
commit 51ab19a263
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -259,6 +259,10 @@ export interface DrawerEmitsOptions {
* Callback to invoke when drawer is shown.
*/
show(): void;
/**
* Callback to invoke before drawer gets hidden.
*/
'before-hide'(): void;
/**
* Callback to invoke when drawer gets hidden.
*/

View File

@ -54,7 +54,7 @@ export default {
name: 'Drawer',
extends: BaseDrawer,
inheritAttrs: false,
emits: ['update:visible', 'show', 'after-show', 'hide', 'after-hide'],
emits: ['update:visible', 'show', 'after-show', 'hide', 'after-hide', 'before-hide'],
data() {
return {
containerVisible: this.visible
@ -113,6 +113,8 @@ export default {
if (this.modal) {
!this.isUnstyled && addClass(this.mask, 'p-overlay-mask-leave');
}
this.$emit('before-hide');
},
onLeave() {
this.$emit('hide');