loading.vue 1.06 KB
<!--
 * @Description: 
 * @Autor: renchao
 * @LastEditTime: 2023-07-25 16:10:17
-->
<template>
  <transition name="el-loading-fade" @after-leave="handleAfterLeave">
    <div v-show="visible" class="el-loading-mask" :style="{ backgroundColor: background || '' }"
      :class="[customClass, { 'is-fullscreen': fullscreen }]">
      <div class="el-loading-spinner">
        <img class="img" src="../../../image/progress.gif" alt="">
        <p v-if="text" class="el-loading-text">{{ text }}</p>
      </div>
    </div>
  </transition>
</template>
<script>
  export default {
    data () {
      return {
        text: null,
        spinner: null,
        background: null,
        fullscreen: true,
        visible: false,
        customClass: ''
      };
    },
    methods: {
      handleAfterLeave () {
        this.$emit('after-leave');
      },
      setText (text) {
        this.text = text;
      }
    }
  };
</script>
<style scoped lang="scss">
  .el-loading-spinner {
    margin-top: -100px !important;

    .img {
      width: 80px;
      height: 80px;
    }
  }
</style>