【发布时间】:2019-11-27 09:07:34
【问题描述】:
我对我的代码有疑问:
我在项目中使用了ListView,代码如下:
<ListView class="list-group" [items]="countries" (itemTap)="onItemTap($event)"
style="height:1250px">
<ng-template let-country="item" let-i="index">
<FlexboxLayout flexDirection="row" class="list-group-item">
<Label [text]="country.name" class="list-group-item-heading"
verticalAlignment="center" style="width: 60%"></Label>
<Label [text]="country.price" class="list-group-item-heading"
verticalAlignment="center" style="width: 60%"></Label>
<Button (tap)="decrementQty($event)" text='-' style="width: 60%">
</Button>
<TextField row="1" col="1" class="textfield" [text]="qty"
editable="false" style="width: 60%">
</TextField>
<Button (tap)="incrementQty($event)" text='+' style="width: 60%">
</Button>
</FlexboxLayout>
</ng-template>
</ListView>
我的问题是:如何使用索引?因此,当我单击按钮 (tap)="incrementQty($event)" 时,我只想在一行中增加 Qty,而不是在所有行中。为此,我在 ng-table 索引中声明,但不是函数。你能建议我任何解决方案吗?
【问题讨论】:
-
你想增加国家列表中的单个项目吗?
-
是的,增加一个项目,而不是全部。
标签: angular typescript listview nativescript