【发布时间】:2019-10-08 20:05:29
【问题描述】:
【问题讨论】:
-
你的意思是按按钮切换到另一个图像,然后按返回按钮切换回原始图像
标签: ionic3
【问题讨论】:
标签: ionic3
这是一个通过动作切换图像的示例组件:
组件的HTML:
<ion-list>
<ion-item *ngIf="showImage1">
<img src="../assets/imgs/dots.gif" height="50px" width="50px" >
</ion-item>
<ion-item *ngIf="showImage2">
<img src="../assets/imgs/dots.gif" height="50px" width="50px" >
</ion-item>
</ion-list>
<ion-button (click)="DoHideImage1()" expand="block" color="light">
Image2
</ion-button>
<ion-button (click)="DoHideImage2()" expand="block" color="light">
Image1
</ion-button>
Typescript of component:
________________________________________
public showImage1: boolean;
public showImage2: boolean;
constructor() {
this.showImage1 = true;
this.showImage2 = false;
}
DoHideImage1(){
this.showImage1 = false;
this.showImage2 = true;
};
DoHideImage2(){
this.showImage1 = true;
this.showImage2 = false;
};
*ngIf 在条件下隐藏!根据您的需要修改示例!
【讨论】: