legacy-modules
legacy-modules copied to clipboard
@nuxtjs/toast - How to pass options to globally configured toast module
How to pass options to globally configured toast module? I could pass the message but not the options.
In my nuxt file I have:
toast: {
position: 'top-center',
register: [
{
name: 'error',
message: (payload: any) => payload.message,
options: {
type: 'error',
icon: 'error',
className: 'toastCustom--error',
position: (payload: any) =>
payload.position ? payload.position : 'top-center',
duration: 5000
}
}
]
}
and passed the option like this
this.$toast.global.error({ message: 'test' }, { position: 'bottom-center' })
What should I do?
Anther question would be how to set globally a duration for both registered and non-registered toasts
Has anyone figured this out?
Passing options via modules sections works fine
modules: [
['@nuxtjs/toast', { duration: 5000 }]
],