I'm trying to get vue-toastify on Nuxt 3 to update the toast, though I'm struggling to make it update even just basic text. Having looked through their docs, I'm updating it correct and the toastId
is returning the same.
This is my code
const toastId = useNuxtApp().$toast.loading('I'm Loading!...', { timeout: -1 });
console.log(toastId)
useNuxtApp().$toast.update(toastId, {
render: 'Not loading anymore',
autoClose: true,
closeOnClick: true,
closeButton: true,
type: 'success',
isLoading: false,
});
Am I doing something fundamentally wrong here?
https://vue3-toastify.js-bridge.com/usage/update-toast.html#basic-example
The code you provided is a bit complicated. Here are two ways you can implement Vue Toastify in your Nuxt 3 project.
Method 1 - Most common usage.
~/plugins/toastify.client.ts
Don't forget to suffix the file name with
.client
.Component usage.
Method 2
~/plugins/toastify.client.ts
Component usage.
Tested and it works. Hope this helps!