ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Vue中同时使用过渡和动画</title> <script src="vue.js"></script> <link rel="stylesheet" href="animate.css"> <style> .fade-enter, .fade-leave-to { opacity: 0; } .fade-enter-active, .fade-leave-active { transition: opacity 3s; } </style> </head> <body> <div id="root"> <!-- appear首次出现--> <!-- 同时使用transition和animated时,会有时长的问题,可以使用type属性来解决--> <!-- type="animation" type="transition" transition在2.6版本好像失效了 --> <!-- <transition name="fade" type="animation"--> <!-- duration 自定义时长 duration="5000" --> <!-- duration="{enter:5000,leave:10000}" 入场时长5秒,出场时长10秒--> <transition name="fade" duration="{enter:5000,leave:10000}" appear appear-active-class="animated swing fade-center-active" enter-active-class="animated swing fade-leave-active" leave-active-class="animated shake" > <div v-show="show">Hello World</div> </transition> <button @click="handleClick">toggle</button> </div> <script> var vm = new Vue({ el: '#root', data: { show: true }, methods: { handleClick() { this.show = !this.show } } }) </script> </body> </html> ~~~