Snackbar, toast, notification and dialog as the messaging components are used frequently in development, which should be bound to vue prototype as a function, like element-ui. For example:
Vue.prototype.$message = function(msgType, position, color, content, ifShowClose, timeout) {
//msgType = 'v-snackbar' || 'v-dialog' || ...
}
So developers can give out a message easily by:
this.$message('v-snackbar', 'top', 'error', 'Bad response from server', true, 3000)
none
Technically a duplicate of #2384
This won't be on the vue prototype, but we may implement a message queue in the snackbar component itself so you can manage them with something like Vuex.
@KaelWD Thanks a lot for the reply. I don't know exactly how you plan to design this message queue, but not all Vue.js projects use something like Vuex to share and store data. Even if in the message queue, developers should not add <v-snackbar> manually to every route-component / component / page, because almost everyone of them needs to deal messaging. I think binding it to Vue.prototype is an easy way to realize the expectation. Don't make it too complicate to use. PS: I agree that there should be only one snackbar shown in the same time.
Most helpful comment
@KaelWD Thanks a lot for the reply. I don't know exactly how you plan to design this message queue, but not all Vue.js projects use something like Vuex to share and store data. Even if in the message queue, developers should not add
<v-snackbar>manually to every route-component / component / page, because almost everyone of them needs to deal messaging. I think binding it toVue.prototypeis an easy way to realize the expectation. Don't make it too complicate to use. PS: I agree that there should be only one snackbar shown in the same time.