How close all notifications in v 1.9.12?
-
Hi. I have action from vuex:
setError (payload) { this.$q.notify({ type: 'negative', message: payload.message, timeout: 0, actions: [ { label: 'Close', color: 'white', handler: () => { /* ... */ } } ] }) }
What action can I create to close this notification?
dismissAllNotifications () { /// ???? }
-
@alex-kulkoff You said you are calling
notify
from a vuex action (at least, this is what I understood). So, you canβt use
this.$q.notify
afaik. You have toimport { Notify} from 'quasar'
and then callNotify.create
.Anyway, both way will return a
dismiss
function you can store somewhere.If you are in a vuex action, for ex :
// VuexState return { notifications: [] // ... } // Vuex Action import { Notify} from 'quasar' setError ({state, commit}, payload) { commit('addError', Notify.create({ type: 'negative', message: payload.message, timeout: 0, // ... }) } // dismissAllErrors action dismissAllErrors({state, commit}) { state.notifications.map(dismiss => dismiss()) commit('clearErrors') } // addError Mutation addError (state, dismiss) { state.notifications.push(dismiss) } // clearErrors Mutation clearErrors (state) { state.notifications = [] }
Did not test, but should work