<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="renderer" content="webkit">
<title></title>
<style>
/* */
.fade-enter {
font-size: 100px;
}
/* / */
/* .fade-enter */
.fade-enter-active {
transition: 3s;
}
/* 2.1.8 ( v-enter )/ */
.fade-enter-to {
font-size: 50px;
}
/* */
.fade-leave {
font-size: 50px;
}
/* / */
/* .fade-leave */
.fade-leave-active {
transition: 2s;
}
/* 2.1.8 ( v-leave )/ */
.fade-leave-to {
font-size: 100px;
}
</style>
</head>
<body>
<div id="app">
<button @click="show = !show"></button>
<transition name="fade" mode="">
<p v-if="show">hello
</transition>
</div>
<script src="https://cdn.bootcss.com/vue/2.5.15/vue.js"></script>
<script>
var app = new Vue({
el: "-sharpapp",
data: {
show: true
}
})
</script>
</body>
</html>
comments are basically comments on the official website
entry transition behavior is basically in line with my expectation
100px entry-> 3s transition to 50px-> restore the original default 16px
exit transition behavior is different from my expectation
expected: 50px start to leave-> 3s transition to 100px-> disappear
actual: 16px start to leave-> 3s transition to 100px-> disappear
that is, the start state of the departure transition set by fade-leave does not take effect as a comment
, while the entry transition start state of the corresponding fade-enter setting takes effect as a comment.
this makes me relatively wonder whether there is something wrong with the annotation or my understanding of v-leave