我有一个问题。
在Vue.js中,你可以通过组件轻松指定淡入/淡出效果。
new Vue({
el: '#demo',
data: {
show: true
}
})
.fade-enter-active, .fade-leave-active {
transition: opacity .5s;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
opacity: 0;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
<button v-on:click="show = !show">
Toggle
</button>
<transition name="fade">
<p v-if="show">hello</p>
</transition>
</div>
我想知道如何在不使用过渡组件的情况下直接实现它。
我已经尝试了几次,但是遇到了困难,如果搜索的话,只能找到jQuery的例子。
我想知道怎么做!