vue 中 lottie动画实战使用

 this.animation = window.lottie.loadAnimation({
        container: window.document.getElementById('sky_falling_surprise'),
        renderer: 'svg',
        loop: true,
        autoplay: false,
        animationData: json,
        name: 'redPacket'
      })
      try {
        // dom 加载完执行
        this.animation.addEventListener('DOMLoaded', () => {
          this.animation.playSegments([0, 70], true)
        })
        this.animation.onLoopComplete = () => {
          this.addListener() // 动画加载完,加载事件
          this.animation.playSegments([71, 110], true)
        }
      } catch (error) {
      }

你可能感兴趣的:(js小问题,vue.js,前端,javascript)