BinarCode / vue-notifyjs

Minimalist 1kb Notification component
MIT License
170 stars 28 forks source link

Vuex Notification Handling #24

Closed dbettin closed 6 years ago

dbettin commented 6 years ago

Is there a best practice for using this lib from Vuex? I am trying to understand how to call this.$notify for any notification that happens within the app.

cristijora commented 6 years ago

@dbettin unfortunately it's not possible to call it from vuex at the moment because it's tied to the local vue instance. It could possibly be modified to allow that similar to http://element.eleme.io/#/en-US/component/notification but I'll have to look into that

ligne13 commented 6 years ago

👍

cristijora commented 6 years ago

Hi @dbettin @ligne13 Released a new version which should make this possible You can now do this import {Notification} from 'vue-notifyjs' Notification.notify({type: 'danger', message: 'My message'}) https://codesandbox.io/s/n7jvkz21y0

More details here https://github.com/cristijora/vue-notifyjs/releases

PS: You need to initialize the plugin anyway if you want to use this feature. This should allow using the Notification inside vuex modules/store since it's not tied to component instances in this case.