Vue動畫--使用 animate.css庫
阿新 • • 發佈:2018-11-08
code:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>使用 animate.css庫</title> <script type="text/javascript" src="js/vue.js" ></script> <!--自定義類名操作--> <!--<style> .active{ transform-origin: left center; animation: bounce-in 1s; } .leave{ transform-origin: left center; animation: bounce-in 1s reverse; } </style>--> <!--使用 animate.css庫--> <link rel="stylesheet" href="css/animate.css" /> </head> <body> <div id="root"> <!--自定義類名操作 <transition enter-active-class="active" leave-active-class="leave" > <div v-if="show">hello world</div> </transition>--> <!--使用 animate.css庫--> <transition enter-active-class="animated swing" leave-active-class="animated shake" > <div v-if="show">hello world</div> </transition> <button @click="handleClick">切換</button> </div> <script> new Vue({ el:"#root", data:{ show:true }, methods:{ handleClick(){ this.show=!this.show } } }) </script> </body> </html>