nebv
2020-10-11 03b6025d07e4df99474f80d3fa57e8b5238ba40c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<template>
  <section class="full-loading" :style="getStyle">
    <BasicLoading :tip="tip" :size="SizeEnum.DEFAULT" />
  </section>
</template>
<script lang="ts">
  import type { PropType } from 'vue';
  import { defineComponent, computed } from 'vue';
  import BasicLoading from './BasicLoading.vue';
 
  import { SizeEnum } from '/@/enums/sizeEnum';
 
  export default defineComponent({
    name: 'FullLoading',
    components: { BasicLoading },
    props: {
      tip: {
        type: String as PropType<string>,
        default: '',
      },
      absolute: Boolean as PropType<boolean>,
    },
    setup(props) {
      // 样式前缀
      const getStyle = computed((): any => {
        return props.absolute
          ? {
              position: 'absolute',
              left: 0,
              top: 0,
              'z-index': 1,
            }
          : {};
      });
      return { getStyle, SizeEnum };
    },
  });
</script>
<style lang="less" scoped>
  .full-loading {
    display: flex;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    justify-content: center;
    align-items: center;
  }
</style>