我用这个简单的代码创建了一个手风琴乐队 menù:
.html
<ion-content>
<ion-item-group *ngFor="let tax of Wiki; let i=index" (click)="toggleGroup(i)" [ngClass]="{active: isGroupShown(i)}" >
<ion-item-divider > {{tax[0]}}</ion-item-divider>
<div *ngIf="isGroupShown(i)">
<button text-wrap menuClose ion-item icon-left *ngFor="let p of tax[1]" (click)="goToPage(p.title.rendered, p.acf.nome, p.id, p.slug)">
{{p.acf.nome}}
</button>
</div>
</ion-item-group>
</ion-content>
.ts
toggleGroup(group) {
if (this.isGroupShown(group)) {
this.shownGroup = null;
} else {
this.shownGroup = group;
}
};
isGroupShown(group) {
return this.shownGroup === group;
};
当我点击ion-item-group并打开手风琴时,有一种方法可以添加平滑动画吗?我没有应用此代码的 CSS。
我已经搜索了很多手风琴教程,但没有一个应用了流畅的动画。
谢谢。