Dialog plugin - template refs are not set when using custom dialog component
See original GitHub issueWhat happened?
When using Dialog plugin with custom component, the template refs that are within the custom dialog component are not set.
Check the jsfiddle below. My expectation is that in the onMounted
hook the cardRef
would be set but it’s not. Even with nextTick
it is still not set.
What did you expect to happen?
Expect template refs to be set and valid within onMounted
hook.
Reproduction URL
https://jsfiddle.net/ddenev/ruhxv3md/37/
How to reproduce?
- Go to the reproduction link
- Make sure the console is visible
- Hit the “Open Dialog” button
- Observe that
cardRef
value isnull
in the console
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Components (quasar), Plugins (quasar)
Platforms/Browsers
No response
Quasar info output
No response
Relevant log output
No response
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Dialog Plugin - Quasar Framework
A Quasar plugin that provides an easy way to display a prompt, choice, confirmation or alert in the form of a dialog.
Read more >How do I use slots with a Quasar Dialog Plugin custom ...
I want to make a custom component for the Quasar Dialog. And inside that component I want to use slots, but I'm not...
Read more >Getting started with Vue Dialog component - Syncfusion
This section explains how to create a simple Dialog and how to configure the Dialog component. Prerequisites. System requirements for Syncfusion Vue UI ......
Read more >Dialog - Kirby CMS
A dialog can easily be combined with a form by using the k-form component. It's important though to setup the submit events correctly....
Read more >How to use a parent (Dialog) component - Quasar forum
Hi,. I would like to create a default parent component from a QDialog. I have created a component/DefaultDialog.vue: <template> <q-dialog ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No,
onMounted
is called when your custom component (that has the dialog in it) is rendered. But that component is rendered before the dialog is opened. BTW,cardRef
is not returned from setup, so it would not work anyway.Working example (listening for
@show
): https://jsfiddle.net/ozcLufgd/3/It’s native Vue behaviour to only set the refs when the element with the ref is rendered. The content of QDialog is a slot, and that slot is rendered only when the dialog is opened. So the refs inside QDialog are set when the dialog is opened and the refs on QDialog are set when the custom component is rendered.