 <template>
  <div v-show="needShow" class="loader" title="2">
    <!-- <div class="loader-mask"></div> -->
    <div class="loader-title">
      <span>{{toastTitle}}</span>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
        needShow: false,
        toastTitle: ''
    };
  },
  methods: {
      toast(toastTitle, time = 1000) {
          this.toastTitle = toastTitle
          this.needShow = true
          window.setTimeout( () => {
              this.needShow = false
              this.toastTitle = ''
          }, time)
      }
  },
};
</script>
<style lang="less" scoped>
.loader {
  &-mask {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.5);
  }
  &-title {
    position: fixed;
    width: 100%;
    left: 0;
    z-index: 301;
    bottom: 30px;
    text-align: center;
    span {
        padding: 2px 10px;
        background: #eee;
    }
  }
}
</style>
