美文网首页Vue
vue中使用animate.css库动画和过度动画

vue中使用animate.css库动画和过度动画

作者: 程序员同行者 | 来源:发表于2018-07-25 13:13 被阅读0次
    <!DOCTYPE html>
    <html>
    <head>
        <title>vue中使用animate.css库动画和过度动画</title>
        <script src="./vue.js"></script>
        <link rel="stylesheet" type="text/css" href="./animate.min.css">
        <style>
                /*// 动画过度*/
            .fade-enter,
            .fade-leave-to {
                opacity: 0;
            }
            .fade-enter-active,
            .fade-leave-active {
                transition: opacity 3s;
            }
            
        </style>
    </head>
    <body>
    <div id='app'>
        <!-- // appear 设置初始动画 -->
        <!-- // :duration 自定义动画时间 -->
        <!-- // type: transition 以 transition动画世界为准-->
        <transition 
                    :duration="{enter:5000,leace:10000}"
                    name="fade"
                    appear
                    enter-active-class="animated swing fade-enter-active"
                    leave-active-class="animated shake fade-leave-active"
                    appear-active-class="animated swing">
        <div v-if="show" >hello world</div>
        </transition>
        <button @click='handleClick'>切换</button>
    </div>
    <script>
        
        var vm1 =  new Vue({
            el: '#app',
            data: {
                show: true
            },
            methods: {
                handleClick: function() {
                    this.show = !this.show
                }
            }
        
            
        })
        
    </script>
    </body>
    </html>
    

    相关文章

      网友评论

        本文标题:vue中使用animate.css库动画和过度动画

        本文链接:https://www.haomeiwen.com/subject/uoxsmftx.html