JavaScript

超轻量级php框架startmvc

vue动画效果实现方法示例

更新时间:2020-08-18 00:06:01 作者:startmvc
本文实例讲述了vue动画效果实现方法。分享给大家供大家参考,具体如下:<!DOCTYPEhtml>&

本文实例讲述了vue动画效果实现方法。分享给大家供大家参考,具体如下:


<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>www.jb51.net vue动画</title>
 <script src="https://cdn.bootcss.com/vue/2.4.4/vue.min.js"></script>
 <link rel="stylesheet" href="https://cdn.bootcss.com/animate.css/2.0/animate.css" rel="external nofollow" />
 <style>
 #box{
 width:400px;
 margin: 0 auto;
 }
 #div1{
 width:100px;
 height:100px;
 background: red;
 }
 </style>
</head>
<body>
 <div id="box">
 <input type="button" value="按钮" @click="toggle">
 <div id="div1" class="animated" v-show="bSign" transition="bounce"></div>
 </div>
 <script>
 new Vue({
 el:'#box',
 data:{
 bSign:true
 },
 methods:{
 toggle(){
 this.bSign=!this.bSign;
 }
 },
 transitions:{ //定义所有动画名称
 bounce:{
 enterClass:'zoomInLeft',//动画进入
 leaveClass:'zoomOutRight'//动画离开
 }
 }
 });
 </script>
</body>
</html>

运行效果:

感兴趣的朋友可以使用在线HTML/CSS/JavaScript代码运行工具:http://tools.jb51.net/code/HtmlJsRun测试上述代码运行效果。

希望本文所述对大家vue.js程序设计有所帮助。

vue 动画效果