mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-03 20:48:07 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			38 lines
		
	
	
		
			705 B
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			705 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" />
 | 
						|
  </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>
 |