Closed joseehilton147 closed 1 year ago
I have no idea of nuxt 3 and their plugin system
I got you Do this.
Create a file in your plugins folder such as toaster.ts paste the following in there:
import { useToast } from 'vue-toast-notification';
const toast = useToast();
export default defineNuxtPlugin(() => {
return {
provide: {
toast,
}
}
});
in your nuxt.config.js add this to your css array
'vue-toast-notification/dist/theme-default.css'
to use the toaster in your component now do this
const { $toast } = useNuxtApp();
$toast.success('You did it!');
have fun!!
const { $toast } = useNuxtApp(); $toast.success('You did it!');
There will be an error in preview mode because named export 'useToast' not found.
I'm submitting a ... (check one with "x")
Its possible to make this works on nuxt 3 as module or show us a integration using the new plugin system please.