我有以下手风琴:
我需要箭头^
在手风琴打开时像这样v
,在手风琴关闭时像这样
标记看起来像这样,注意(click)="toggleAssignedTasks()"
手风琴div
标题与此我 toggleAssignedTasks 然后我将 fontawesome 向下箭头的类相应地更改为向上或向上:
<accordion class="row th-assigned-ready">
<accordion-group [isOpen]="isAssignedTasksVisible" >
<div class="th-heading" accordion-heading (click)="toggleAssignedTasks()">
<strong class="th-text-ready">Ready for Review (2)</strong>
<i class="fa"
[ngClass]="{'fa-chevron-down': isAssignedTasksVisible, 'fa-chevron-up': !isAssignedTasksVisible}"
aria-hidden="true"></i>
</div>
...
</accordion-group>
</accordion>
这是可行的,但是当用户单击手风琴时,事件会变得混乱,似乎(单击)事件正在被手风琴默认事件吸收。
我还尝试在手风琴中使用原生 [showArrows]="true",如下所示:
但我得到错误:
Promise rejection: Template parse errors:
Can't bind to 'showArrows' since it isn't a known native property ("
</div>
<accordion class="row th-assigned-ready" [ERROR ->][showArrows]="true" >
<accordion-group [isOpen]="isAssignedTasksVisible" >
"):
更新:
toggleAssignedTasks() 看起来像这样
public toggleAssignedTasks(): void {
this.isAssignedTasksVisible = (this.isAssignedTasksVisible) ? false : true;
}