<template>
  <section class="full-loading" :class="{ absolute }"
    :style="[background ? `background-color: ${background}` : '']" v-show="loading">
    <Spin v-bind="$attrs" :spinning="loading" />
  </section>
</template>
<script lang="ts">
import { PropType, defineComponent } from 'vue';
// import { Spin } from 'ant-design-vue';
import Spin from '@/components/Spin/index.vue';

export default defineComponent({
  name: 'Loading',
  components: { Spin },
  props: {
    tip: {
      type: String as PropType<string>,
      default: '',
    },
    absolute: {
      type: Boolean as PropType<boolean>,
      default: false,
    },
    loading: {
      type: Boolean as PropType<boolean>,
      default: false,
    },
    background: {
      type: String as PropType<string>,
    },
  },
});
</script>
<style lang="scss" scoped>
.full-loading {
  display: flex;
  position: fixed;
  z-index: 200;
  top: 0;
  left: 0;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: rgb(240 242 245 / 40%);

  &.absolute {
    position: absolute;
    z-index: 300;
    top: 0;
    left: 0;
  }
}
</style>
