main.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import { createApp } from 'vue'; import { createNotivue } from 'notivue'; import App from './App.vue'; import 'notivue/notification.css'; // For built-in Notification import 'notivue/animations.css'; // For default animations const notivue = createNotivue(); const app = createApp(App); app.use(notivue); app.mount('#app'); |
App.vue
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<template> <div id="app"> <h1>Notivue Example: Toast Notifications</h1> <!-- Buttons to trigger notifications --> <div class="button-group"> <button @click="push.success('Success! Operation completed successfully.')"> Show Success </button> <button @click="push.error('Error! Something went wrong.')"> Show Error </button> <button @click="push.info('Info! This is an informational message.')"> Show Info </button> <button @click="push.warning('Warning! Be cautious about this.')"> Show Warning </button> </div> <!-- Notivue Notification Container --> <Notivue v-slot="item"> <Notification :item="item" /> </Notivue> </div> </template> <script setup> import { Notivue, Notification, push } from 'notivue'; </script> |