We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am trying to send events from a dynamic dialog as shown in the example in your documentation: https://primevue.org/dynamicdialog/#events
However, this does not work. Maybe I'm doing something wrong?
index.vue
<template> <div> <h1>Example Page</h1> <Button label="Open Dynamic Dialog" @click="openDialog" /> </div> </template> <script setup lang="ts"> import ExampleDialog from '~/components/ExampleDialog.vue'; const dialog = useDialog(); const openDialog = () => { dialog.open(ExampleDialog, { props: { header: 'Example Dialog', modal: true, }, onSaved: () => { alert('saved'); // ----------- Not called }, }); }; </script>
ExampleDialog.vue
<template> <div> <p>Test stackblitz alert works</p> <Button label="Test alert" @click="testAlert" /> <br /> <br /> <p>Ok, lets try emit 'saved' event from dynamic dialog</p> <Button label="Save" @click="save" /> </div> </template> <script setup lang="ts"> const emit = defineEmits(['saved']); const testAlert = () => { alert('Its works!'); }; const save = () => { emit('saved'); }; </script>
No response
https://stackblitz.com/edit/nuxt-starter-mecvw6bm?file=pages%2Findex.vue,components%2FExampleDialog.vue
macOS Sequoia, Google Chrome
The problem reproducible in stackblitz
3.5.13
4.2.5
v18.19.0
I expected the event to be passed to the page and an alert to occur. But this does not happen.
The text was updated successfully, but these errors were encountered:
You need to add emits object. It's written in the documentation but the example isn't updated:
The emits object defines callbacks to handle events emitted by the component within the Dialog.
<template> <div> <h1>Example Page</h1> <Button label="Open Dynamic Dialog" @click="openDialog" /> </div> </template> <script setup lang="ts"> import ExampleDialog from '~/components/ExampleDialog.vue'; const dialog = useDialog(); const openDialog = () => { dialog.open(ExampleDialog, { props: { header: 'Example Dialog', modal: true, }, emits: { onSaved: () => { alert('saved'); } } }); }; </script>
Sorry, something went wrong.
Thanks for the updates. The documentation will be updated.
a0ebfc6
tugcekucukoglu
No branches or pull requests
Describe the bug
I am trying to send events from a dynamic dialog as shown in the example in your documentation:
https://primevue.org/dynamicdialog/#events
However, this does not work. Maybe I'm doing something wrong?
index.vue
ExampleDialog.vue
Pull Request Link
No response
Reason for not contributing a PR
Other Reason
No response
Reproducer
https://stackblitz.com/edit/nuxt-starter-mecvw6bm?file=pages%2Findex.vue,components%2FExampleDialog.vue
Environment
macOS Sequoia, Google Chrome
The problem reproducible in stackblitz
Vue version
3.5.13
PrimeVue version
4.2.5
Node version
v18.19.0
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
I expected the event to be passed to the page and an alert to occur. But this does not happen.
The text was updated successfully, but these errors were encountered: