<template>
  <div class="overlay" v-if="isOverlay">
      <div class="ya-dot-spin">
        <i class="ya-spin-dot-item"></i>
        <i class="ya-spin-dot-item"></i>
        <i class="ya-spin-dot-item"></i>
        <i class="ya-spin-dot-item"></i>
      </div>
    </div>
</template>
<script lang="ts" setup>
const { isOverlay = false } = defineProps({
  isOverlay: Boolean,
});
</script>
<style lang="scss" scoped>
.overlay {
  background: rgba(0, 0, 0, 0.5);
  // backdrop-filter: blur(10px);//毛玻璃属性
  position: fixed;
  width: 100%;
  left: 0;
  min-height: calc(100vh);
  z-index: 9;
  top: 0;
  .ya-dot-spin {
  z-index: 999;
  display: inline-block;
  font-size: 24px;
  width: 1em;
  height: 1em;
  position: relative;
  left: 50%;
    top: 50vh;
  transform: rotate(45deg);
  animation-name: css-rotate;
  animation-duration: 1.2s;
  animation-iteration-count: infinite;
  animation-timing-function: linear;

  @keyframes css-rotate {
    to {
      transform: rotate(405deg);
    }
  }
  .ya-spin-dot-item {
    position: absolute;
    display: block;
    width: 7px;
    height: 7px;
    background-color: #12c1e7;
    border-radius: 50%;
    transform: scale(0.75);
    transform-origin: 50% 50%;
    opacity: 0.3;
    animation-name: css-spinMove;
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-timing-function: linear;
    animation-direction: alternate;

    @keyframes css-spinMove {
      to {
        opacity: 1;
      }
    }

    &:nth-child(1) {
      top: 0;
      inset-inline-start: 0;
    }

    &:nth-child(2) {
      top: 0;
      inset-inline-end: 0;
      animation-delay: 0.4s;
    }

    &:nth-child(3) {
      inset-inline-end: 0;
      bottom: 0;
      animation-delay: 0.8s;
    }

    &:nth-child(4) {
      bottom: 0;
      inset-inline-start: 0;
      animation-delay: 1.2s;
    }
  }
}
}
</style>