Skip to content

Commit 4897313

Browse files
author
robotism
committed
update
1 parent f07838f commit 4897313

File tree

2 files changed

+73
-3
lines changed

2 files changed

+73
-3
lines changed

src/pages/index.vue

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,73 @@
11
<template>
22
<div
3-
class="mx-auto max-w-md rounded-xl bg-white shadow-md md:max-w-2xl"
4-
></div>
3+
class="q-pa-md relative-position"
4+
style="height: 100vh; max-height: 100vh"
5+
>
6+
<div
7+
class="absolute-top-left bg-red text-white q-ma-md q-pa-lg"
8+
style="border-radius: 10px; font-size: 32px"
9+
v-morph:topleft:boxes:800="morphGroupModel"
10+
>
11+
Top left
12+
</div>
13+
14+
<div
15+
class="absolute-top-right bg-blue text-white q-ma-lg q-pa-xl"
16+
style="border-radius: 20px; font-size: 18px"
17+
v-morph:topright:boxes:600.tween="morphGroupModel"
18+
>
19+
Top right
20+
</div>
21+
22+
<div
23+
class="absolute-bottom-right bg-orange text-white q-ma-lg q-pa-lg"
24+
style="border-radius: 0"
25+
v-morph:bottomright:boxes:400="morphGroupModel"
26+
>
27+
Bottom right
28+
</div>
29+
30+
<div
31+
class="absolute-bottom-left bg-green text-white q-ma-xl q-pa-md"
32+
style="border-radius: 40px; font-size: 24px"
33+
v-morph:bottomleft:boxes:600.resize="morphGroupModel"
34+
>
35+
Bottom left
36+
</div>
37+
38+
<q-btn
39+
class="absolute-center"
40+
color="purple"
41+
label="Next morph"
42+
no-caps
43+
@click="nextMorph"
44+
/>
45+
</div>
546
</template>
6-
<script lang="ts" setup></script>
47+
48+
<script>
49+
import { ref } from "vue";
50+
51+
const boxValues = ["topleft", "topright", "bottomleft", "bottomright"];
52+
53+
export default {
54+
setup() {
55+
const morphGroupModel = ref("topleft");
56+
57+
return {
58+
morphGroupModel,
59+
nextMorph() {
60+
let value = morphGroupModel.value;
61+
62+
// pick random box, other than current one
63+
while (value === morphGroupModel.value) {
64+
const i = Math.floor(Math.random() * boxValues.length);
65+
value = boxValues[i];
66+
}
67+
68+
morphGroupModel.value = value;
69+
},
70+
};
71+
},
72+
};
73+
</script>

src/plugins/ready.client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default defineNuxtPlugin(() => {
2+
onNuxtReady(async () => {});
3+
});

0 commit comments

Comments
 (0)