Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
racode246 opened this issue Apr 10, 2020 · 3 comments
Open

Comments

@racode246
Copy link

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?

@marcosdipaolo
Copy link

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

@andrewbartz
Copy link

Has anyone figured this out?

@TArch64
Copy link

TArch64 commented Apr 10, 2022

Passing options via modules sections works fine

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants