forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasic.vue
More file actions
97 lines (84 loc) · 2.35 KB
/
Basic.vue
File metadata and controls
97 lines (84 loc) · 2.35 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<template>
<div class="q-pa-md" style="max-width: 350px">
<q-list bordered separator>
<q-slide-item @left="onLeft" @right="onRight">
<template v-slot:left>
<q-icon name="done" />
</template>
<template v-slot:right>
<q-icon name="alarm" />
</template>
<q-item>
<q-item-section avatar>
<q-avatar color="primary" text-color="white" icon="bluetooth" />
</q-item-section>
<q-item-section>Icons only</q-item-section>
</q-item>
</q-slide-item>
<q-slide-item @left="onLeft" @right="onRight">
<template v-slot:left>
Left
</template>
<template v-slot:right>
Right content.. long
</template>
<q-item>
<q-item-section avatar>
<q-avatar>
<img src="https://cdn.quasar.dev/img/avatar6.jpg" draggable="false">
</q-avatar>
</q-item-section>
<q-item-section>Text only</q-item-section>
</q-item>
</q-slide-item>
<q-slide-item @left="onLeft" @right="onRight">
<template v-slot:left>
<div class="row items-center">
<q-icon left name="done" /> Left
</div>
</template>
<template v-slot:right>
<div class="row items-center">
Right content.. long <q-icon right name="alarm" />
</div>
</template>
<q-item>
<q-item-section avatar>
<q-avatar>
<img src="https://cdn.quasar.dev/img/avatar4.jpg" draggable="false">
</q-avatar>
</q-item-section>
<q-item-section>Text and icons</q-item-section>
</q-item>
</q-slide-item>
</q-list>
</div>
</template>
<script>
import { useQuasar } from 'quasar'
import { onBeforeUnmount } from 'vue'
export default {
setup () {
const $q = useQuasar()
let timer
function finalize (reset) {
timer = setTimeout(() => {
reset()
}, 1000)
}
onBeforeUnmount(() => {
clearTimeout(timer)
})
return {
onLeft ({ reset }) {
$q.notify('Left action triggered. Resetting in 1 second.')
finalize(reset)
},
onRight ({ reset }) {
$q.notify('Right action triggered. Resetting in 1 second.')
finalize(reset)
}
}
}
}
</script>