在Vue中使用 animate.css 庫

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>在Vue中使用 animate.css 庫</title>
    <script src="./vue.js"></script>
    <link rel="stylesheet" type="text/css" href="./animate.css">
    <style>
        /*@keyframes bounce-in {*/
            /*0%{*/
                /*transform:scale(0);*/
            /*}*/
            /*50%{*/
                /*transform:scale(1.5);*/
            /*}*/
            /*100%{*/
                /*transform:scale(0);*/
            /*}*/
        /*}*/
        /*自定義屬性名稱*/
        /*.active{*/
            /*transform-origin:left center;*/
            /*animation:bounce-in 1s;*/
        /*}*/
        /*.leave{*/
            /*transform-origin:left center;*/
            /*animation:bounce-in 1s reverse;*/

        /*}*/
        /*.fade-enter-active{*/
            /*transform-origin:left center;*/
            /*animation:bounce-in 1s;*/
        /*}*/
        /*.fade-leave-active {*/
            /*transform-origin:left center;*/
            /*animation:bounce-in 1s reverse;*/

        /*}*/

    </style>
</head>
<body>
<div id="root">
    <transition
        name="fade"
        enter-active-class="animated lightSpeedIn"
        leave-active-class="animated lightSpeedOut">  <!--加動畫效果 使用animate庫 必須class命名注意 class類裏面必須包含animated這個單詞加上動畫效果名稱-->
        <div v-show="show">hello world</div> <!--v-if與v-show都是能夠帶動畫效果的-->
    </transition>
    <button @click="handleClick">toggle</button>
</div>
<script>

    var vm = new Vue({
        el: '#root',
        data: {
            show: true
        },
        methods: {
            handleClick: function () {
                this.show = !this.show
            }
        }
    })
</script>
</body>
</html>
相關文章
相關標籤/搜索