当前位置:
首页 >
Vue 进入/离开动画
发布时间:2025/7/14
59
豆豆
生活随笔
收集整理的这篇文章主要介绍了
Vue 进入/离开动画
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
1、示例代码
(注:写到vue单文件中了)
<template><div><button v-on:click="show = !show">Toggle</button><transition name="fade"><p v-if="show">hello</p></transition></div> </template> <script>export default {data: function() {return {show: true}}} </script> <style>.fade-enter-active,.fade-leave-active {transition: opacity .5s}.fade-enter,.fade-leave-to {opacity: 0} </style>2、说明
(1)需要transition 标签包裹。
(2)6个class状态
(3)效果:
总结
以上是生活随笔为你收集整理的Vue 进入/离开动画的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 华为清除配置
- 下一篇: Vue封装一个简单轻量的上传文件组件