需要注意的是:
animate的动画在一加载的时候,所有动画都加载完毕,所以翻到后面swiper页面时设置的delay就看不到了。使用“swiper-animate-effect”,每切换一帧都能看到对应的时延,即动画从0时刻开始。
1.先安装:
npm install animate.css --save
2、下载animate.js包
打开链接: https://www.swiper.com.cn/download/index.html#file8,
下载“swiper.animate1.0.3.min.js”,放到“assets/js/swiper.animate1.0.3.min.js”目录下(该文件需修改适应es6,并添加代码行:‘export {swiperAnimateCache,swiperAnimate};’)。
3.上代码:
main.js:
import animated from 'animate.css'
Vue.use(animated)
HTML:
<div class="ani"
swiper-animate-effect="bounceInDown"
swiper-animate-duration="1s"
swiper-animate-delay="0s">
</div>
JS:
import {swiperAnimateCache,swiperAnimate} from "../../assets/js/swiper.animate1.0.3.min.js"
data(){
return{
swiperOption: {
loop: true,