1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8"> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7 <meta http-equiv="X-UA-Compatible" content="ie=edge"> 8 <title>Document</title> 9 <script src="./lib/jquery2.1.4.min.js"></script> 10 <script src="./lib/Vue2.5.17.js"></script> 11 <link href="https://cdn.bootcss.com/animate.css/3.7.0/animate.css" rel="stylesheet"> 12 </head> 13 14 <body> 15 <div id="app"> 16 <input type="button" value="toggle" @click="flag=!flag"> 17 <!-- duration属性规定动画进入和离开所花费的时间 --> 18 <!-- <transition enter-active-class="animated bounceIn" leave-active-class="animated bounceOut" :duration="400"> 19 <h3 v-if="flag">这是一个H3</h3> 20 </transition> --> 21 <!-- 分开绑定时间 --> 22 <transition enter-active-class="animated bounceIn" leave-active-class="animated bounceOut" :duration="{ enter:200,leave:400 }"> 23 <h3 v-if="flag">这是一个H3</h3> 24 </transition> 25 </div> 26 <script> 27 var vm = new Vue({ 28 el: ‘#app‘, 29 data: { 30 flag: false, 31 }, 32 methods: { 33 34 }, 35 }) 36 </script> 37 </body> 38 39 </html>
原文地址:https://www.cnblogs.com/winter-shadow/p/10198804.html
时间: 2024-10-11 03:41:51