How to use vue2.0 transition to complete the effect of moving the mouse up, sliding out the QR code from the outside of the screen, leaving the QR code and sliding out of the screen. The following is the code I wrote,
But what I wrote failed Yes: When the mouse is moved up, the box slides over, but the box disappears without leaving the mouse. Solution
.erweima {
position: fixed;
left: -100px;
bottom: 200px;
}
.fade-enter-active, .fade-leave-active {
transition: all 1s ease;
left: -100px;
}
.fade-enter, .fade-leave-active {
left: 100px
}
<a class='wechat' href="" @mouseenter="show=!show" @mouseleave="show=!show"></a>
<transition name='fade'>
<p v-show="show" class="erweima" style="width: 100px; height: 100px;"><img src="../../static/img/image/wechat_hov.png" alt=""></p>
</transition>
Change it to the following and try it
Or like this
Css cannot be written like this. .fade-enter-active, .fade-leave-active classes will be removed after the animation is completed. After removal, it will be your original css style. Therefore, after the animation is executed, 2 The QR code disappeared again