primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
8.71k stars 1.09k forks source link

Toast: Using toast from custom directive doesn't work #5829

Open mbaljeetsingh opened 4 weeks ago

mbaljeetsingh commented 4 weeks ago

Describe the bug

I'm trying to use toast component inside the custom directive. But, I get following error,

image

Is there a way to resolve this

For now, I'm using browser alert to show the message, but I want to use Toast component.

Reproducer

https://stackblitz.com/edit/hmfrv9?file=src%2Fdirectives%2Fpermission.js,src%2Fmain.js,src%2FApp.vue

PrimeVue version

3.43.0

Vue version

3.x

Language

ALL

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

There should be a way to access toast globally from anywhere in the app.

mbaljeetsingh commented 2 weeks ago

The issue is still present with primevue v4

https://stackblitz.com/edit/wc1hhz?file=src%2Fdirectives%2Fpermission.js,src%2Fmain.js,src%2FApp.vue