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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
<template>
<div class="wrapper">
<div v-if="hint" class="emptycontent">
<IconLoading :size="20" />
<h2>{{ hint }}</h2>
<transition name="fade">
<em v-if="slowHint && slow">{{ slowHint }}</em>
</transition>
</div>
<IconLoading v-else class="container" />
</div>
</template>
<script>
import IconLoading from '@nextcloud/vue/dist/Components/NcLoadingIcon'
export default {
name: 'Loading',
components: {
IconLoading,
},
props: {
hint: {
type: String,
default: '',
required: false,
},
slowHint: {
type: String,
default: '',
required: false,
},
},
data() {
return {
slow: false,
slowTimer: undefined,
}
},
mounted() {
clearTimeout(this.slowTimer)
this.slowTimer = setTimeout(() => {
this.slow = true
}, 3500)
},
beforeDestroy() {
clearTimeout(this.slowTimer)
},
}
</script>
<style lang="scss" scoped>
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
.wrapper {
display: flex;
justify-content: space-around;
flex-direction: column;
flex: 1 auto;
}
</style>
|