/
CaLoading.vue
60 lines (57 loc) · 1.15 KB
/
CaLoading.vue
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
<template>
<div :class="overlayClass">
<div data-loading class="bx--loading" :class="smallClass">
<svg class="bx--loading__svg" viewBox="-75 -75 150 150">
<title>Loading</title>
<circle cx="0" cy="0" r="37.5" />
</svg>
</div>
</div>
</template>
<script>
import { Loading } from 'carbon-components';
export default {
data() {
return {
loading: null,
};
},
props:{
show: {
type: Boolean,
default: true
},
withoutOverlay: {
type: Boolean,
default: false
},
small: {
type: Boolean,
default: false
}
},
name: 'ca-loading',
watch: {
show (newValue) {
this.loading.set(newValue)
}
},
computed: {
overlayClass () {
return {
'bx--loading-overlay': !this.withoutOverlay
}
},
smallClass () {
return {
'bx--loading--small': this.small
}
}
},
mounted() {
this.loading = Loading.create(this.$el.querySelector('[data-loading]'));
this.loading.set(this.show);
},
};
</script>
<style></style>