gpt4 book ai didi

angular - 当我展开一个标签部分时,所有克拉箭头都朝上。只有选定的箭头应该出现

转载 作者:行者123 更新时间:2023-11-28 00:46:40 26 4
gpt4 key购买 nike

enter image description here实际上有四个选项卡,每个选项卡上都有克拉点击功能。当我展开一个标签部分时,所有克拉箭头都朝上。只有选定的箭头应该出现

accountSelection(account) {
if (!this.selectedAccount || account.accountId !== this.selectedAccount.accountId) {
this.selectedAccount = account;
this.selectedAccountTransactions = this.transactionData.unrealizedGainLossDetails.filter(acc => acc.accountId === this.selectedAccount.accountId);
this.initialPaging();
} else {
this.selectedAccount = undefined;
this.selectedAccountTransactions = undefined;
this.unrealizedTransaction = undefined;
}
this.cd.detectChanges();
}
<span class="col-md-1 p-0 acc-carat col-sm-1" (click)="accountSelection(account)" *ngIf="!transactionsInfo.loading">
<i _ngcontent-c2="" *ngIf="!selectedAccount " class="fa fa-caret-down" aria-hidden="true"></i>
<i _ngcontent-c2="" *ngIf="selectedAccount" class="fa fa-caret-up" aria-hidden="true"></i>
</span>

最佳答案

即使你可以像这样使用对象的新属性来设置 -

<span class="col-md-1 p-0 acc-carat col-sm-1" (click)="accountSelection(account)" *ngIf="!transactionsInfo.loading">
<i _ngcontent-c2="" *ngIf="account?.open" class="fa fa-caret-down" aria-hidden="true"></i>
<i _ngcontent-c2="" *ngIf="!account?.open" class="fa fa-caret-up" aria-hidden="true"></i>
</span>

accountSelection(account) {
..... //Set (open = false) for every item in array
account.open = true;
this.cd.detectChanges();
}

现在您正在使用全局变量 selectedAccount,它会在您每次调用函数时更新。

关于angular - 当我展开一个标签部分时,所有克拉箭头都朝上。只有选定的箭头应该出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53496500/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com