I'm using Quasar Framework V2 for a SPA and I need to create a class in which I can declare all the shared functions/methods on the app to reduce code writing.
For example, to show an alert from the Notify plugin you have to use this code:
$q.notify({
message: 'Error',
color: 'primary',
actions: [
{ label: 'Dismiss', color: 'white', handler: () => { /* ... */ } }
]
})
It's too long to write this in every event I want that notification to be called. But I don´t know the right way to do this on Quasar. I tried using boot files but failed
I just want to call notifyError() from a global class/mixin/boot or whatever.
Something like this:
const notifyError = () => {
$q.notify({
message: 'Jim just pinged you.',
color: 'primary',
avatar: 'https://cdn.quasar.dev/img/boy-avatar.png',
actions: [
{ label: 'Reply', color: 'yellow', handler: () => { /* ... */ } },
{ label: 'Dismiss', color: 'white', handler: () => { /* ... */ } }
]
})
}