Vue中如何使用 velocity動畫庫


第一步:npm install velocity-animate@beta --save-dev 

安裝velocity動畫庫

 

第二步:在main.js引入

// 動畫庫
import Velocity from 'velocity-animate'
Vue.prototype.Velocity = Velocity
第三步應用:
<template>
<transition v-on:after-enter="afterEnter" v-on:enter="enter"> <div class="slide-move__line" v-if="show"></div> </transition>
</template>
methods:{
afterEnter:function(el){
     console.log(el);
},
enter:function(el,done){ console.log("顯示"); console.log(el); this.Velocity(el, { opacity: 1, left: '100px' }, { duration: 300 }) this.Velocity(el, { left: '90px' }, { complete: done }) }
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM