Open Grzyb9k opened 2 years ago
I have the same issue but with Symfony 5.4 and Webpack Encore.
What I found interesting, is that when I put those notifications to mount()
or setup()
, they will work once after hot-reload (encore dev-server). But when I refresh the page, they don't show, even though they should because mount()
and setup()
are being executed again.
Then when I change even a single character in the vue component, and this triggers hot reload - it shows up again just once.
Using this.toast('test')
works fine every time, when triggered by a button or when triggered after fetch
finishes.
There are no errors, warnings, notifications whatsoever.
It's as if toastification would cache somewhere that this particular toast from this particular place in js code has been shown before and it ignores it.
Hi,
I've more or less the same setup with Laravel 9 and Vue 3. Found a (ugly) workaround. To show the toasts, put the toast method call into a timeout.
MyComponent.vue
<template>
</template>
<script>
import { useToast } from "vue-toastification";
export default {
props: ["level", "content"],
setup() {
const toast = useToast();
return { toast };
},
mounted() {
setTimeout(() => {
this.toast[this.level](this.content);
});
}
};
</script>
@msch-alpgis I have almost the same setup and I thought I was crazy because there is literally no indication of it not working, this workaround solved my problem as well... Strange issue.
I want use
vue-toastification
in my laravel 8 blade templates. I have idea to make vue 3 component and pass to him byprops
notifications from laravel. I want to see notifications when site is loaded.Unfortunately, it doesn't work for me in any way. Notifications work when will assign them, for example, to the
@click
event on button. However, they do not want to act on their own by callingthis.$toast
version
files
app.js
Notification.vue
Can anyone help me with that?