Files
chatwoot/app/javascript/src/components/SnackbarContainer.vue
T
2a34255e0b Initial Commit
Co-authored-by: Subin <subinthattaparambil@gmail.com>
Co-authored-by: Manoj <manojmj92@gmail.com>
Co-authored-by: Nithin <webofnithin@gmail.com>
2019-08-14 15:18:44 +05:30

38 lines
719 B
Vue

<template>
<transition-group name="toast-fade" tag="div" class="ui-snackbar-container">
<woot-snackbar :message="snackMessage" v-for="snackMessage in snackMessages" v-bind:key="snackMessage"></woot-snackbar>
</transition-group>
</template>
<script>
/* global bus */
import WootSnackbar from './Snackbar';
export default {
props: {
duration: {
default: 2500,
},
},
data() {
return {
snackMessages: [],
};
},
mounted() {
bus.$on('newToastMessage', (message) => {
this.snackMessages.push(message);
window.setTimeout(() => {
this.snackMessages.splice(0, 1);
}, this.duration);
});
},
components: {
WootSnackbar,
},
};
</script>