如果满足条件,我需要从列表视图中删除/隐藏一个项目:getData 和 getCategory Name 都相等。我在控制台日志中进行了测试,对于前三项,上述两个条件是相等的。
因此,基于此,我需要隐藏该项目。我尝试了下面的代码。它对我不起作用。
编辑:
html:
<GridLayout >
<ListView (setupItemView)="onSetupItemView($event)" [items]="allFeedItems" class="list-group">
<ng-template let-item="item" let-visible="visible">
<StackLayout [visibility]="visible ? 'visible' : 'collapsed'" class="card-view" margin="10">
<StackLayout>
<StackLayout orientation="horizontal">
<Image src={{item.iconName}} stretch="none" class="item-icon"></Image>
<Label class="item-category" [text]="item.category"></Label>
</StackLayout>
<StackLayout orientation="horizontal">
<Label class="item-time" text="4 hours ago"></Label>
</StackLayout>
<StackLayout orientation="vertical">
<Image src={{item.imageUrl}} stretch="aspectFill" width="100%" height="50%" class="item-image"></Image>
<Label class="item-title" [text]="item.title" textWrap="true"></Label>
</StackLayout>
</StackLayout>
</StackLayout>
</ng-template>
</ListView>
<Image src="res://pref_circle" (setupItemView)="showModal($event)" verticalAlignment="bottom" horizontalAlignment="right" minWidth="45" height ="45" ></Image>
我正在使用模态自定义对话框屏幕。当从模态对话框返回时,其触发代码如下:
ts文件:
public showModal(args: SetupItemViewArgs) {
let options = {
context: {},
fullscreen: true,
viewContainerRef: this.vcRef
};
this.modal.showModal(ModalComponent, options).then(res => {
console.log("Res:", res);
console.log("PrintCategory2", StatusBar.categoryArr);
let i = args.index;
let barCategory = StatusBar.categoryArr[i];
let dataCategory = this.allFeedItems[i].category;
if (barCategory === dataCategory) {
args.view.context.visible = false;
} else {
args.view.context.visible = true;
}
});
单击图像时,我正在触发 showmodel 对话框。当从模态对话框获得响应时,它将触发这一行 : this.modal.showModal(ModalComponent, options).then(res =>
。
我的问题是:单击模态对话框时未触发。因为我在这个方法中添加了 SetUpItemViewArgs :public showModal(args: SetupItemViewArgs)