zoukankan      html  css  js  c++  java
  • vue18 动画

    <!-- bower-> (前端)包管理器
        npm install bower -g
            验证: bower --version
    
    bower install <包名>
    bower uninstall <包名>
    bower info <包名>    查看包版本信息
    
    <script src="bower_components/vue/dist/vue.js"></script>
    -->
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <script src="bower_components/vue/dist/vue.js"></script>
        <style>
            #div1{
                width:100px;
                height:100px;
                background: red;
            }
            .fade-transition{  //整体动画
                transition: 1s all ease;    
            }
            .fade-enter{  //进入:
                opacity: 0;
            } 
            .fade-leave{ //离开:
                opacity: 0;
                transform: translateX(200px);  //右边飞
            }
        </style>
    </head>
    <body>
        <div id="box">
            <input type="button" value="按钮" @click="toggle">
            <div id="div1" v-show="bSign" transition="fade"></div>  <!--transition="fade" 固定写法:动画名称-->
        </div>
    
        <script>
            new Vue({
                el:'#box',
                data:{
                    bSign:true
                },
                methods:{
                    /*toggle:function(){
                        alert(1);
                    }*/
                    toggle(){//es6语法,等价上面写法,
                        this.bSign=!this.bSign;
                    }
                }
            });
        </script>
    </body>
    </html>
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
        <script src="bower_components/vue/dist/vue.js"></script>
        <link rel="stylesheet" href="bower_components/animate.css/animate.css">
        <!-- animate.css动画库 -->
        <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:{//动画名称 transition="bounce"
                        enterClass:'zoomInLeft',
                        leaveClass:'zoomOutRight'
                    }
                }
            });
        </script>
    </body>
    </html>
  • 相关阅读:
    js中定时器2
    js中定时器之一
    js中的Event对象
    hdu 1041(递推,大数)
    hdu 1130,hdu 1131(卡特兰数,大数)
    hdu 2044-2050 递推专题
    hdu 3078(LCA的在线算法)
    hdu 1806(线段树区间合并)
    hdu 3308(线段树区间合并)
    poj 2452(RMQ+二分查找)
  • 原文地址:https://www.cnblogs.com/yaowen/p/6977690.html
Copyright © 2011-2022 走看看