Skip to content

Commit 2e573cf

Browse files
committed
feat: Add test content with fade transition and enhance App component
1 parent 2124ede commit 2e573cf

File tree

1 file changed

+60
-32
lines changed

1 file changed

+60
-32
lines changed

demo-app-vite/src/App.vue

+60-32
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<template>
22
<div>
33
<header class="bg-blue-300 rounded-lg shadow-lg p-4 mx-0 md:mx-20">
4-
54
<nav>
65
<ul class="flex justify-between sm:mx-1 md:mx-20">
76
<li>
@@ -22,34 +21,47 @@
2221
<header
2322
class="bg-gray-800 text-white text-center p-4 mt-4 rounded-lg shadow-lg mx-0 md:mx-20"
2423
>
25-
<div
26-
style="display: flex; justify-content: space-between; "
27-
>
28-
<div class=" text-black flex">
29-
<input
30-
class="p-2 rounded-lg shadow-lg"
31-
:value="modelValue"
32-
@input="$emit('update:modelValue', ($event.target as HTMLInputElement)?.value)"
33-
/>
34-
<div class="text-white ml-4 align self-center">
35-
{{ modelValue }}
24+
<div style="display: flex; justify-content: space-between">
25+
<div class="text-black flex">
26+
<input
27+
class="p-2 rounded-lg shadow-lg"
28+
:value="modelValue"
29+
@input="
30+
$emit(
31+
'update:modelValue',
32+
($event.target as HTMLInputElement)?.value
33+
)
34+
"
35+
/>
36+
<div class="text-white ml-4 align self-center">
37+
{{ modelValue }}
38+
</div>
3639
</div>
40+
41+
<button
42+
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
43+
@click="testEmit"
44+
>
45+
emit event outside
46+
</button>
3747
</div>
38-
39-
<button
40-
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
41-
@click="testEmit"
42-
>
43-
emit event outside
44-
</button>
45-
</div>
4648
</header>
4749
<main class="mt-4 p-4 mx-0 md:mx-20 bg-gray-200 rounded-lg shadow-lg">
4850
<router-view />
51+
52+
<button @click="showTestContent = !showTestContent">
53+
Toggle Test Content
54+
</button>
55+
<Transition name="fade">
56+
<div v-if="showTestContent" class="test-content">
57+
<p>This is test content that should fade.</p>
58+
</div>
59+
</Transition>
4960
</main>
50-
<footer class="bg-gray-800 text-white text-center p-4 mt-4 rounded-lg shadow-lg mx-0 md:mx-20">
61+
<footer
62+
class="bg-gray-800 text-white text-center p-4 mt-4 rounded-lg shadow-lg mx-0 md:mx-20"
63+
>
5164
<div class="mb-2">
52-
5365
<slot></slot>
5466
</div>
5567
<div class="flex justify-center">
@@ -60,6 +72,8 @@
6072
</template>
6173

6274
<script lang="ts">
75+
import { ref } from 'vue';
76+
6377
export default {
6478
name: 'App',
6579
namedSlots: ['customName'], // only needed with Shadow DOM
@@ -81,19 +95,17 @@ export default {
8195
apiToken: '',
8296
baseUri: '',
8397
},
98+
showTestContent: false, // Added for test
8499
}),
85100
86-
87101
methods: {
88102
testEmit() {
89-
this.$emit('customEventTest',
90-
{
91-
testEvent: '123456789',
92-
}
93-
)
94-
}
103+
this.$emit('customEventTest', {
104+
testEvent: '123456789',
105+
});
106+
},
95107
},
96-
}
108+
};
97109
</script>
98110
<style>
99111
.test-heading {
@@ -104,11 +116,27 @@ a {
104116
@apply text-gray-900 hover:text-gray-700;
105117
}
106118
107-
header {
119+
header {
108120
@apply font-sans;
109121
}
110122
111123
main {
112124
@apply font-sans;
113125
}
114-
</style>
126+
127+
/* Added for test transition */
128+
.test-content {
129+
background-color: lightblue;
130+
padding: 20px;
131+
margin-top: 10px;
132+
}
133+
.fade-enter-active,
134+
.fade-leave-active {
135+
transition: opacity 0.5s ease;
136+
}
137+
138+
.fade-enter-from,
139+
.fade-leave-to {
140+
opacity: 0;
141+
}
142+
</style>

0 commit comments

Comments
 (0)