legacy-modules icon indicating copy to clipboard operation
legacy-modules copied to clipboard

@nuxtjs/toast - How to pass options to globally configured toast module

Open racode246 opened this issue 5 years ago • 3 comments

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?

racode246 avatar Apr 10 '20 03:04 racode246

Anther question would be how to set globally a duration for both registered and non-registered toasts

marcosdipaolo avatar Jun 07 '20 23:06 marcosdipaolo

Has anyone figured this out?

andrewbartz avatar Apr 14 '21 00:04 andrewbartz

Passing options via modules sections works fine

    modules: [
        ['@nuxtjs/toast', { duration: 5000 }]
    ],

TArch64 avatar Apr 10 '22 14:04 TArch64