File tree 1 file changed +63
-1
lines changed
1 file changed +63
-1
lines changed Original file line number Diff line number Diff line change
1
+ <script >
2
+ export default {
3
+ data : () => ({
4
+ isDragon: true
5
+ }),
6
+ computed: {
7
+ displayDragonStyles () {
8
+ return this .isDragon ? ' is-visible' : ' '
9
+ },
10
+ displayUnicornStyles () {
11
+ return this .isDragon ? ' ' : ' is-visible'
12
+ }
13
+ }
14
+ }
15
+ </script >
16
+
1
17
<template >
2
18
<div class =" about" >
3
- <h1 >This is an about page</h1 >
19
+ <div class =" creature-cage" >
20
+ <transition name =" fade" >
21
+ <h1 v-if =" isDragon" class =" creature" >
22
+ Dragon 🐉
23
+ </h1 >
24
+ <h1 v-else class =" creature" >Unicorn 🦄</h1 >
25
+ </transition >
26
+ </div >
27
+ <button @click =" isDragon = !isDragon" >Toggle Dragon</button >
4
28
</div >
5
29
</template >
30
+
31
+ <style >
32
+ .creature-cage {
33
+ position : relative ;
34
+ display : block ;
35
+ margin : 0 auto ;
36
+ height : 86px ;
37
+ }
38
+
39
+ .creature {
40
+ position : absolute ;
41
+ left : 50% ;
42
+ transform : translateX (-50% );
43
+ }
44
+
45
+ .fade-enter-active ,
46
+ .fade-leave-active {
47
+ transition : opacity 0.5s ease ;
48
+ }
49
+
50
+ .fade-enter-from ,
51
+ .fade-leave-to {
52
+ opacity : 0 ;
53
+ }
54
+
55
+ a {
56
+ border : 2px solid darkblue ;
57
+ background-color : white ;
58
+ color : darkblue ;
59
+ text-decoration : none ;
60
+ transition : background-color 0.2s ease-in , color 0.2s ease-in ;
61
+ }
62
+
63
+ a :hover {
64
+ background-color : darkblue ;
65
+ color : white ;
66
+ }
67
+ </style >
You can’t perform that action at this time.
0 commit comments