zhengyiming
2025-02-10 958b79ed89b9e742540f714a80261d222c0fc09b
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
49
50
51
52
53
<template>
  <div class="loading-layout-wrapper">
    <div class="spinner-wrapper" v-if="props.loading">
      <div class="el-loading-spinner">
        <el-icon class="is-loading">
          <Loading />
        </el-icon>
        <p class="el-loading-text">拼命加载中</p>
      </div>
    </div>
    <template v-else>
      <div v-if="props.error">出错了</div>
      <template v-else>
        <slot></slot>
      </template>
    </template>
  </div>
</template>
 
<script setup lang="ts">
defineOptions({
  name: 'LoadingLayout',
});
 
type Props = {
  loading?: boolean;
  error?: boolean;
};
 
const props = withDefaults(defineProps<Props>(), {
  loading: false,
  error: false,
});
</script>
 
<style lang="scss" scoped>
.loading-layout-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}
 
.spinner-wrapper {
  min-height: calc(100vh - 80px);
  // position: relative;
}
 
.hasTagsView {
  .spinner-wrapper {
    min-height: calc(100vh - 124px);
  }
}
</style>