angular - 角过渡动画ngIf:如何在:enter完成后触发:leave
问题描述
我将如何实现 :enter 动画以 0.25 秒的延迟开始?我不想在 :leave 完成后专门启动 :enter ,只需延迟 0.25 秒启动 :enter 。
当前实现的问题在于,在转换期间,两个选项卡内容都堆叠在另一个之下。
模板:
<div [@fadeContent] *ngIf="isActive1" class="content-wrapper">
<ng-content></ng-content>
</div>
<div [@fadeContent] *ngIf="isActive2" class="content-wrapper">
<ng-content></ng-content>
</div>
角组件动画:
@Component({
selector: 'tab',
templateUrl: './tab.component.html',
styleUrls: ['./tab.component.scss'],
animations: [
trigger('fadeContent', [
transition(':leave', [
animate('0.25s', style({opacity: 0}))
]),
transition(':enter', [
style({opacity: 0}),
animate('0.25s', style({opacity: 1}))
]),
])
]
})
解决方案
推荐阅读
- react-native - 使用在本机反应
- java - Java 数组不接受值
- android - 代码不起作用: void main() => runApp(MaterialApp(home: Center(child: Text('Hello World'))));
- php - 在我的 show.blade.php 文件中,当我遍历 $category->posts 时,我想排除视图显示的帖子
- javascript - 如果反应js中没有孙子项目,隐藏父项目标题的最佳方法
- gpflow - 具有先验分布的长度尺度自动相关性确定
- c# - 动态修改 appsettings.json 和刷新 Web 应用程序 - ASP.NET Core 和 Docker
- sql - 有没有办法找到去年任何 90 天期间的最高 90 天总价值?
- sql - 如何从 SQL 中的列中提取数值
- php - 如何在 PHP 中将二维数组转换为三维数组?