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
42 lines (38 loc) · 910 Bytes
/
Basic.vue
File metadata and controls
42 lines (38 loc) · 910 Bytes
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
<template>
<div class="q-pa-md">
<p>
Switch to another browser tab or app then come back here to see some changes.
</p>
<q-markup-table v-if="eventList.length > 0">
<tbody>
<tr v-for="evt in eventList" :key="evt.timestamp">
<td>{{ evt.timestamp }}</td>
<td>{{ evt.label }}</td>
</tr>
</tbody>
</q-markup-table>
</div>
</template>
<script>
function pad (number) {
return (number < 10 ? '0' : '') + number
}
export default {
data () {
return {
eventList: []
}
},
watch: {
'$q.appVisible' (state) {
const date = new Date()
this.eventList.unshift({
timestamp: pad(date.getHours()) + ':' +
pad(date.getMinutes()) + ':' + pad(date.getSeconds()) + '.' +
date.getMilliseconds(),
label: `App became ${state ? 'visible' : 'hidden'}`
})
}
}
}
</script>