如何实现离子芯片可点击,当点击页面导航到另一个页面时?
How to implement ion-chip clickable, when click page navigate to another page?
我是ionic 4框架,因为我用的是ion-chip,我希望这个ion-chip可以点击。例如,当我点击离子芯片时,导航到另一个页面。Here is the ion-chip documentation
您可以添加 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');
}
如果你添加可点击指令那么它也很好用
<ion-chip (click)="openPage()" tappable>
<ion-label>Home</ion-label>
</ion-chip>
我是ionic 4框架,因为我用的是ion-chip,我希望这个ion-chip可以点击。例如,当我点击离子芯片时,导航到另一个页面。Here is the ion-chip documentation
您可以添加 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');
}
如果你添加可点击指令那么它也很好用
<ion-chip (click)="openPage()" tappable>
<ion-label>Home</ion-label>
</ion-chip>