forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndeterminateProgress.vue
More file actions
81 lines (74 loc) · 2.02 KB
/
IndeterminateProgress.vue
File metadata and controls
81 lines (74 loc) · 2.02 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
<template>
<div class="q-pa-md q-gutter-sm">
<q-btn :loading="loading[0]" color="secondary" @click="simulateProgress(0)" label="Button" />
<q-btn :loading="loading[1]" color="red" @click="simulateProgress(1)">
Button
<template v-slot:loading>
Loading...
</template>
</q-btn>
<q-btn :loading="loading[2]" color="purple" @click="simulateProgress(2)">
Button
<template v-slot:loading>
<q-spinner-radio />
</template>
</q-btn>
<q-btn :loading="loading[3]" color="primary" @click="simulateProgress(3)" style="width: 150px">
Button
<template v-slot:loading>
<q-spinner-hourglass class="on-left" />
Loading...
</template>
</q-btn>
<br>
<q-btn round :loading="loading[4]" color="brown" @click="simulateProgress(4)" icon="camera_front">
<template v-slot:loading>
<q-spinner-facebook />
</template>
</q-btn>
<q-btn round :loading="loading[5]" color="black" @click="simulateProgress(5)" icon="camera_rear">
<template v-slot:loading>
<q-spinner-gears />
</template>
</q-btn>
<br>
<q-btn :loading="progress" color="primary" @click="progress = true">
Controlled from outside
<template v-slot:loading>
<q-spinner-radio class="on-left" />
Click "Stop" Button
</template>
</q-btn>
<q-btn :disable="!progress" color="negative" @click="progress = false" label="Stop" />
</div>
</template>
<script>
import { ref } from 'vue'
export default {
setup () {
const loading = ref([
false,
false,
false,
false,
false,
false
])
const progress = ref(false)
function simulateProgress (number) {
// we set loading state
loading.value[ number ] = true
// simulate a delay
setTimeout(() => {
// we're done, we reset loading state
loading.value[ number ] = false
}, 3000)
}
return {
loading,
progress,
simulateProgress
}
}
}
</script>