1. 程式人生 > >Vue系列之 => 使用第三方animated.css動畫

Vue系列之 => 使用第三方animated.css動畫

 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>