【发布时间】:2017-09-25 10:51:30
【问题描述】:
我有一个使用离子网格构建的列表,其中行代表项目。
我正在使用 css 动画库 https://github.com/fabiandev/css-animator 在用户删除列表中的项目时显示动画。 html看起来像
<ion-list>
<ion-grid no-padding>
<ion-row *ngFor="let task of tasks" no-padding style="border-top:1px solid #AFAFAF">
<ion-col no-padding #myElement>
<ion-row nowrap><ion-col col-1><ion-icon *ngIf="task.overdue == 'true'" color="danger" name="alert"></ion-icon></ion-col>
<ion-col >
<ion-label class="widget-para-title">{{task.name}}</ion-label>
<ion-label class="widget-para-text">{{task.description}}</ion-label>
</ion-col>
<ion-col col-auto>
<ion-icon style="color:#8D8D8D;zoom:1.5" name="ios-more" (click)="delete($event, task.taskId)"></ion-icon>
</ion-col>
</ion-row>
</ion-col>
</ion-row>
</ion-grid>
</ion-list>
删除事件:
delete() {
this.animator.setType('rollOut').show(this.myElem.nativeElement);
this.tasks = this.tasks.filter(
(data) => data.taskId != id
)
})
所以如果我评论过滤器部分,我会看到动画。但是如果我取消注释,那么我不会因为我猜删除元素(数组过滤器)会杀死它。应该怎么处理呢
【问题讨论】:
标签: angular css-animations ionic3