vue3.0项目中lottie解析json动画格式

前言

最近的项目中有展示动图的需求,ui之前给了gif文件,但扩展性太局限,所以采取了通过json解析动画的形式。

具体实现

采取Lottie 来将json解析成动画,但因为项目使用的是Vue3.0,所以Lottie官方提供的npm是无效的,需要使用vue3-lottie

javascript 复制代码
npm install vue3-lottie@latest --save

在页面中使用

javascript 复制代码
import { Vue3Lottie } from "vue3-lottie";

然后引入你的json文件

路径按照你存放的json文件路径来就行哈

下一步 应用

javascript 复制代码
 <div class="inviteFriends">
          <Vue3Lottie :animationData="RedbagJSON" class="vue3Lottie" />
          邀好友
   </div>

来看下效果图吧

这个小红包是可以摇晃的 此处没有录屏软件就不展示了 ~

相关推荐
wtsolutions3 小时前
Understanding Excel Data Formats - What Excel to JSON Supports
ui·json·excel
wtsolutions7 小时前
Real-World Use Cases - How Organizations Use Excel to JSON
json·github·excel
cab57 小时前
MyBatis如何处理数据库中的JSON字段
数据库·json·mybatis
FITA阿泽要努力7 小时前
动手体验:5min实现第一个智能体——1
json·api·agent·requests·查询天气·pprint·f-string
wtsolutions7 小时前
Using the Excel to JSON API - Programmatic Access for Developers
ui·json·xhtml
石云升8 小时前
Claude Code 配置教程:如何通过修改 settings.json 优化 AI 编程体验
人工智能·json
wtsolutions9 小时前
MCP Service Integration - Excel to JSON for AI and Automation
人工智能·json·excel
cjp5609 小时前
019.C#管道服务,两软件间用json数据交互
开发语言·c#·json
组合缺一9 小时前
FastJson2 与 SnackJson4 有什么区别?
java·json·fastjson·snackjson