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

How to Set Global Defaults #81

Open
cliftonlabrum opened this issue May 14, 2019 · 1 comment
Open

How to Set Global Defaults #81

cliftonlabrum opened this issue May 14, 2019 · 1 comment

Comments

@cliftonlabrum
Copy link

I'm trying to set a couple global defaults so that all instances of my snotify popups have timeout:0 and showProgressBar: false but I can't get it to work.

In main.js of my Vue project, I have set up Snotify with the following:

//Super-cute Popups
Vue.config.productionTip = false
import Snotify, { SnotifyPosition } from 'vue-snotify'
import '@/assets/snotify.css'

Vue.use(Snotify, {
  toast: {
    position: SnotifyPosition.rightTop
  },
  defaults: {
    timeout:0,
    showProgressBar: false
  }
})

The popups work fine, but those global defaults don't apply anywhere. Does anyone know how to use setDefaults properly? Thanks!

@samuelterra22
Copy link

samuelterra22 commented Jul 9, 2019

@cliftonlabrum , try a setup similar to this:

import Vue from 'vue'
import Snotify, { SnotifyPosition } from 'vue-snotify'

const options = {
  global: {
    showProgressBar: false,
    pauseOnHover: true,
    newOnTop: true,
    oneAtTime: true,
    preventDuplicates: true,
    titleMaxLength: 110,
    bodyMaxLength: 1110,
    timeout: 5000
  },
  toast: {
    position: SnotifyPosition.rightTop
  }
}

Vue.use(Snotify, options)

basically, try changing from "defaults" to "global"

obs.: i'm using Nuxtjs

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

2 participants