-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Add ability to listen for transition events on v-dialog #6504
Comments
Related: #5516 |
Use this function to patch the original component and forward the import {VDialog as VDialogOriginal} from 'vuetify/lib';
/**
* Hack to patch VDialog because it has no way to set transition hooks
*/
function patchVDialog (VDialog) {
const ExtendedVDialog = VDialog.extend({});
const originalRender = ExtendedVDialog.prototype.constructor.options.render;
ExtendedVDialog.prototype.constructor.options.render = function (h) {
const originalH = h;
h = (...args) => {
// Check for the call to render a transition,
// there is only one rendered transition in VDialog
if (args[0] === 'transition') {
// Forward the user provided listeners to the transition component
args[1].on = this.$listeners;
}
return originalH(...args);
};
return originalRender.call(this, h);
};
return ExtendedVDialog;
}
// This can be used now in place of the original.
const VDialog = patchVDialog(VDialogOriginal); |
Any news on when there will be working transition hooks for v-dialog? I cannot get any of transitionend or after-enter to trigger. Thank you |
Trying to figure out the status of this? Should it be working at this point or it's not implemented? I am not having any luck using transition callbacks on v-dialog. |
In my case I need this functionality to properly set the width of an element that is part of the dialog content. It depends on the width of other elements in there, and I can't simply set it as soon as the dialog's model value changes because the content is not yet fully rendered as it is transitioning in. |
I agree that this would be useful. I have the same use case as @flyingL123 with a SVG drawing that needs to be updated with the correct size. Currently I am doing this with a setTimeout, but this is a bit ugly. |
Temporary solution:
v-dialog
|
@b-strauss Can you give a complete example of using this hack? |
you need to include the patched VDialog to use inside your template const VDialog = patchVDialog(VDialogOriginal);
export default {
components: {
VDialog,
},
}; Then in the template just add your listeners to the patched component. <v-dialog @after-enter=""></v-dialog> |
Vuetify 2.5.10 patch does not work. I looked at the sources and implemented a working patch
|
@alekstar79 this doesn't work... can't catch @leave-enter... |
I was reading the documentation to find this exact behavior and it isn't mentioned. Glad I can do it as @after-leave works on the v-dialog element, but it would be nice to add thoses events to the api page. |
I've added information regarding the events in 8083d89 |
Problem to solve
Sometimes it is needed to run some code when v-dialog closes but do it only after closing animation ends, the problem is that at the moment there seems to be no way to determine when it ends.
Proposed solution
A possible solution would be to pass $listeners from v-dialog to the transition component. E.g.
So that it could be used like this:
The text was updated successfully, but these errors were encountered: