# Transitions
# Transition Classes
When setting up an transition named fadeMe
for instance. Vue.js will automatically look for the classes :
.fadeMe-enter
.fadeMe-enter-active
.fadeMe-leave
.fadeMe-leave-active
# Input
<template>
<div>
<button @click="showing = !showing">Kill</button>
<transition name="fadeMe">
<span v-if="showing"> Hi, this is Don Lewis !</span>
</transition>
</div>
</template>
<script>
export default {
data() {
return {
showing: true
}
}
}
</script>
<style scoped>
.fadeMe-enter {
opacity: 0;
}
.fadeMe-enter-active {
transition: opacity 1s;
}
.fadeMe-leave {
/*opacity: 1; no need to set it as it is default */
}
.fadeMe-leave-active {
transition: opacity 1s;
opacity: 0;
}
</style>
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
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
# Output
Hi, this is Don Lewis !