forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicGroup.vue
More file actions
75 lines (65 loc) · 1.64 KB
/
BasicGroup.vue
File metadata and controls
75 lines (65 loc) · 1.64 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
<template>
<div class="q-pa-md relative-position" style="height: 600px; max-height: 80vh">
<div
class="absolute-top-left bg-red text-white q-ma-md q-pa-lg"
style="border-radius: 10px; font-size: 32px"
v-morph:topleft:boxes:800="morphGroupModel"
>
Top left
</div>
<div
class="absolute-top-right bg-blue text-white q-ma-lg q-pa-xl"
style="border-radius: 20px; font-size: 18px"
v-morph:topright:boxes:600.tween="morphGroupModel"
>
Top right
</div>
<div
class="absolute-bottom-right bg-orange text-white q-ma-lg q-pa-lg"
style="border-radius: 0"
v-morph:bottomright:boxes:400="morphGroupModel"
>
Bottom right
</div>
<div
class="absolute-bottom-left bg-green text-white q-ma-xl q-pa-md"
style="border-radius: 40px; font-size: 24px"
v-morph:bottomleft:boxes:600.resize="morphGroupModel"
>
Bottom left
</div>
<q-btn
class="absolute-center"
color="purple"
label="Next morph"
no-caps
@click="nextMorph"
/>
</div>
</template>
<script>
import { ref } from 'vue'
const boxValues = [
'topleft',
'topright',
'bottomleft',
'bottomright'
]
export default {
setup () {
const morphGroupModel = ref('topleft')
return {
morphGroupModel,
nextMorph () {
let value = morphGroupModel.value
// pick random box, other than current one
while (value === morphGroupModel.value) {
const i = Math.floor(Math.random() * boxValues.length)
value = boxValues[ i ]
}
morphGroupModel.value = value
}
}
}
}
</script>