angular - 如何在 angluar11 中使用 lottie-web?
问题描述
我从事一个有角度的项目。我需要在我的项目中添加动画图标。所以我将使用lottie-web。我已经安装了lottie-web。我遵循了本指南https://www.npmjs.com/package/lottie-web。但图标不显示。
我已将 lottie-web 导入我的 compenent.ts 文件并这样写。
import Lottie from 'lottie-web';
ngOnInit(): void {
Lottie.loadAnimation({
container: document.getElementById('logo'),
renderer: 'svg',
loop:false,
autoplay:true,
path:'./home.json',
});
}
在 .html 文件中我这样写
<div class="logo">
<div id="logo"></div>
</div>
我从https://lordicon.com/下载 .json 文件。
我的问题是我的页面上没有显示图标。我如何在 angluar11 中使用 lottie-web?
解决方案
推荐阅读
- sockets - 在封闭的 net.Conn 上写入但返回 nil 错误
- ios - 在 CollectionView 滚动期间不必要地打开 YouTube 播放器
- java - 在云环境中创建的单例对象
- scala - 如何解决损坏的传递 jsDependencies?
- javascript - 在 Angular 5 中通过 *ngIf 销毁组件?
- javascript - Javascript获取打印元素的高度
- node.js - MongoDB - 2 个集合中的 $lookup 和 $aggregate
- togaf - 在 TOGAF 技术栈和平台(java、.net、移动等)的哪个阶段确定
- java - 凌空抽射。发送 JSONObject 作为参数
- java - SpringSession HttpSession 与 redis