-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue-transition-multi-com.html
50 lines (50 loc) · 1.27 KB
/
vue-transition-multi-com.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="./vue.js"></script>
<style>
.component-fade-enter-active,
.component-fade-leave-active {
transition: opacity 0.3s ease;
}
.component-fade-enter, .component-fade-leave-to
/* .component-fade-leave-active for below version 2.1.8 */ {
opacity: 0;
}
</style>
</head>
<body>
<div id="app">
<transition name="component-fade" mode="out-in">
<component v-bind:is="view ? 'v-a' : 'v-b'"></component>
</transition>
<input type="checkbox" id="v-a" v-model="view" />
<label for="v-a">{{ view }}</label>
</div>
<script>
const data = {
view: false,
};
const vm = new Vue({
el: "#app",
components: {
"v-a": {
template: "<div>Component A</div>",
},
"v-b": {
template: "<div>Component B</div>",
},
},
data,
watch: {},
computed: {},
methods: {},
mounted: function () {},
});
</script>
</body>
</html>