【发布时间】:2019-09-02 02:20:46
【问题描述】:
我是 ionic 4 框架,因为我使用了 ion-chip,我想要这个 ion-chip 可点击。例如,当我点击 ion-chip 时,导航到另一个页面。Here is the ion-chip documentation
【问题讨论】:
-
发布你尝试过的内容
标签: angular ionic-framework angular-ui-router ionic4
我是 ionic 4 框架,因为我使用了 ion-chip,我想要这个 ion-chip 可点击。例如,当我点击 ion-chip 时,导航到另一个页面。Here is the ion-chip documentation
【问题讨论】:
标签: angular ionic-framework angular-ui-router ionic4
如果你添加了 tappable 指令,那么它也可以正常工作
<ion-chip (click)="openPage()" tappable>
<ion-label>Home</ion-label>
</ion-chip>
【讨论】:
您可以添加 routerLink 任何元素以导航到另一个页面。
<ion-chip routerLink="/home">
<ion-label>Home</ion-label>
</ion-chip>
<ion-chip>
<ion-label routerLink="/details/42" color="secondary"> Details </ion-label>
</ion-chip>
或者你在组件(html)中:
<ion-chip (ionClick)="openPage()">
<ion-label>Home</ion-label>
</ion-chip>
组件:
openPage(){
this.router.navigateByUrl('/home');
}
【讨论】: