1. 程式人生 > >vue動畫

vue動畫

nbsp spa asc ogg sla ansi car transform ade

vue有自帶動畫這個屬性:

在需要動畫的元素外圍包裹上標簽,同時用name 屬性表明動畫的類型

 <transition name="toggle-cart">
            <div class="shopcart_detail " v-show="listShow">
               
            </div>
        </transition>
        
        <transition name="fade">
            <div class="list_masck animated fadeIn
" v-show="listShow"></div> </transition>

css中動畫的寫法很簡單

/** 動畫 **/
.toggle-cart-enter-active, .toggle-cart-leave-active {
    transition: all .3s ease-out;
}
.toggle-cart-enter, .toggle-cart-leave-active {
    transform: translateY(100%);
}
.fade-enter-active, .fade-leave-active {
    transition: opacity .5s;
}
.fade
-enter, .fade-leave-active { opacity: 0; }

vue動畫