How to Set Global Defaults
Opened this issue · 1 comments
cliftonlabrum commented
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 commented
@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