vue 中使用wow.js 以及wow踩坑指南

wowjs 依赖animate.css 需要单独安装
wowjs githup 地址  https://github.com/matthieua/WOW#readme
npm 地址 https://github.com/animate-css/animate.css
animate.css 地址  npm install animate.css --save

使用步骤

1.  npm install wowjs --save-dev
2.  npm install animate.css --save

vue 注册wowjs

main.js
     import 'animate.css/animate.min.css'
app.vue

import { WOW } from 'wowjs'

  watch: {
    $route(to, from) {
      this.$nextTick(() => {
        new WOW({ mobile: true, live: true, scrollContainer: '.layout-content' }).init()
      })
    }
  },


使用
        <div
          class="trait-item wow bounceInUp"
          data-wow-duration="1s"
          :data-wow-delay="index + 5 + 's'"
          v-for="(item, index) in traits"
          :key="index"
        >
          <img :src="item.img" alt="" />
        </div>


注意
1.scrollContainer  放实际滚动的容器   一般不用填此项
2. 引入wowjs 和初始化方式

元素 消失不见  概率是容器填错了  例如 移动端 底部为tabbar  浏览器实际没有滚动 wow是根据容器滚动判断才执行显示的   
有问题查官方文档才是最好的方法 链接上面有  

使用的包相应版本

    "wowjs": "^1.1.3"

    "animate.css": "^3.7.2"

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值