1
1
<template >
2
2
<div >
3
3
<header class =" bg-blue-300 rounded-lg shadow-lg p-4 mx-0 md:mx-20" >
4
-
5
4
<nav >
6
5
<ul class =" flex justify-between sm:mx-1 md:mx-20" >
7
6
<li >
22
21
<header
23
22
class =" bg-gray-800 text-white text-center p-4 mt-4 rounded-lg shadow-lg mx-0 md:mx-20"
24
23
>
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 >
36
39
</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 >
37
47
</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 >
46
48
</header >
47
49
<main class =" mt-4 p-4 mx-0 md:mx-20 bg-gray-200 rounded-lg shadow-lg" >
48
50
<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 >
49
60
</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
+ >
51
64
<div class =" mb-2" >
52
-
53
65
<slot ></slot >
54
66
</div >
55
67
<div class =" flex justify-center" >
60
72
</template >
61
73
62
74
<script lang="ts">
75
+ import { ref } from ' vue' ;
76
+
63
77
export default {
64
78
name: ' App' ,
65
79
namedSlots: [' customName' ], // only needed with Shadow DOM
@@ -81,19 +95,17 @@ export default {
81
95
apiToken: ' ' ,
82
96
baseUri: ' ' ,
83
97
},
98
+ showTestContent: false , // Added for test
84
99
}),
85
100
86
-
87
101
methods: {
88
102
testEmit() {
89
- this .$emit (' customEventTest' ,
90
- {
91
- testEvent: ' 123456789' ,
92
- }
93
- )
94
- }
103
+ this .$emit (' customEventTest' , {
104
+ testEvent: ' 123456789' ,
105
+ });
106
+ },
95
107
},
96
- }
108
+ };
97
109
</script >
98
110
<style >
99
111
.test-heading {
@@ -104,11 +116,27 @@ a {
104
116
@apply text-gray- 900 hover :text-gray-700;
105
117
}
106
118
107
- header {
119
+ header {
108
120
@apply font-sans ;
109
121
}
110
122
111
123
main {
112
124
@apply font-sans ;
113
125
}
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