<template>
  <div class="mask">
    <div class="tip" v-show="display">{{tip}}</div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      display: false,
      tip: "",
      timer: 0
    };
  },
  props: {
    // scid: {
    //     type: Number,
    //     default: 0
    // }
  },
  methods: {
    initData(){

    },
    showTip(str){
      clearTimeout(this.timer);
      this.tip = str;
      this.display = true;
      this.timer = setTimeout(() => {
        this.display = false;
      }, 2500);
    }
  }
};
</script>

<style lang="less" scoped>
.mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 4;
  background: rgba(0, 0, 0, 0);
}
.tip{
  display: inline-block;
  text-align: center;
  padding: 20px;
  border-radius: 12px;
  color: #fff;
  background: rgba(0, 0, 0, 0.7);
  font-size: 24px;
  opacity: 0;
  animation: 2s fade;
}
@keyframes fade {
  0% { opacity: 0; transform: translateY(20px);}
  20% { opacity: 1; transform: translateY(0px);}
  80% { opacity: 1; transform: translateY(0px);}
  100% { opacity: 0; transform: translateY(-20px);}
}
</style>