Problem with Dynamic Dialog custom events (Vue3 Composition API)

UI Components for Vue
Post Reply
marcilio_junior
Posts: 1
Joined: 13 Mar 2023, 20:50

13 Mar 2023, 21:06

Hi masters,

I'm facing problems with the component DynamicDialog in Vue Composition API. The custom event not firing.

Code: Select all

// Parent component
<script setup>
import {useDialog} from "primevue/usedialog";

const dialog = useDialog();

function userDialog()
    {
	dialog.open(UserDetail, {
                props: {
                    style: {
                        width: '50vw',
                    },
                    breakpoints:{
                        '960px': '75vw',
                        '640px': '90vw'
                    },
                    modal: true
                },
                emits: {
                    onDeactivate: (info) => {
                        console.log(info);
                    }
                }
            }); 
 }
</script>

<template>
	<button @click="userDialog">Open dialog</button>
</template>
... And the UserDetail children component code below:

Code: Select all

<script setup>
	const emit = defineEmits(['deactivate']);
	
	function deactivate(){
		emit('deactivate', {info: 'my info'});
	}
</script>

<template>
	<button @click="deactivate">Deactivate</button>
</template>
The Dialog it opens correctly with the UserDetail child component on it. The "onDeactivate" event is never fired and no errors showing on the console.
Anyone has a idea what I'm doing wrong?

PS: I'm using PrimeVue 3.23.0.

mragrid
Posts: 2
Joined: 07 Apr 2023, 06:44

07 Apr 2023, 06:46

Same problem, the emit does not fire the logic in the parent component

mragrid
Posts: 2
Joined: 07 Apr 2023, 06:44

08 Apr 2023, 01:34

An update to the version 3.26.1 solved my problem, give it a try ;)

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests