<template>
  <div class="el-toast">
    <div>
      <slot>{{message}}</slot>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ElToast',
  data() {
    return {
      duration: 1500, // 默认toast消失的时间
      message: '' // toast显示的内容
    };
  },
  mounted() {
    setTimeout(()=>{
      this.$destroy(true);
      this.$el.parentNode.removeChild(this.$el);
    }, this.duration);
  }
};
</script>