h5 实现json数据动画效果

<template>
  <div>
    <lottie
      :options="defaultOptions"
      :height="400"
      :width="400"
      v-on:animCreated="handleAnimation"
    />
    <div>数字</div>
  </div>
</template>

 

<script>
  import Lottie from 'vue-lottie' //第三方插件
  import * as animationData from './assets/data.json' //需要展示的json动画
  export default {
    components: {
      lottie: Lottie, //注册动画组件
    },
    data() {
      return {
        defaultOptions: { animationData: animationData.default },
      }
    },
    methods: {
      handleAnimation: function (anim) {
        this.anim = anim
      },
    },
}
</script>
//josn 文件是ui 将动画图转出的 
posted @ 2021-12-27 13:52  有肌肉的小眼睛  阅读(785)  评论(0)    收藏  举报