我遵循this个分段条形。
仅当我有一些要显示的数据时,我才在该细分市场中遇到问题。
我有这个JSON文件
JS: evgpsbyclientid1 from ws [{
JS: "datetime_device": "2018-07-03 12:07:00",
JS: "alarmdesc": "call",
JS: "device_serial": "hb5testing",
JS: "dtm_acted": "2018-07-10 03:07:11",
JS: }, {
JS: "datetime_device": "2018-07-03 12:07:00",
JS: "alarmdesc": "fire",
JS: "device_serial": "hb6testing",
JS: "dtm_acted": "2018-07-10 03:07:11",
JS: }
要在模板中显示,我尝试了以下代码:
<SegmentedBar [items]="items" (selectedIndexChange)="onSelectedIndexChange($event)" class="m-5"></SegmentedBar>
<GridLayout rows="*" visibility="{{ visibility3 ? 'visible' : 'collapsed' }}" backgroundColor="red">
<StackLayout *ngFor="let item of itemsevents" [class.odd]="odd" [class.even]="even" margin="5" verticalAlignment="center"
backgroundColor="#FFFFFF" borderRadius borderWidth="2" borderColor="#0000ff" padding="15">
<Label></Label>
<StackLayout class="hr-light m-10"></StackLayout>
<Label row="1" col="1" text="" class="list-group-item-text" [text]='"Date: " + item.datetime_device'></Label>
<Label row="1" col="1" text="" class="list-group-item-text" [text]='"Desc: " + item.alarmdesc'></Label>
<Label row="1" col="1" text="" class="list-group-item-text" [text]='"Serial: " + item.device_serial'></Label>
<Label row="1" col="1" text="" class="list-group-item-text" [text]='"Date Acted: " + item.dtm_acted'></Label>
</StackLayout>
</GridLayout>
此代码仅使我讨厌Json文件中的第一个元素,而又不hb5testing
,而不是所有数据。
当我删除SegmentedBar
时,在模板中显示所有数据。
你能问我什么问题吗?