创建页面:

1、cd 到项目目录 
2、通过ionic g page 页面名称 
3、创建完成组件以后会在 src 目录下面多一个 button 的目录,它既是一个页面也是一个 模块。
4、如果我们想在 tab1 里面写一个按钮点击跳转到 button 页面的话我们可以通过使用 Angular 的路由跳转。在 ionic4.x 中路由是完全基于 angular,用法几乎和 angular 一样。
5、ionic4.x 中跳转到其他页面不会默认加返回按钮,如果我们想给 button 页面加返回的话 需要找到 button 对应的 button.page.html,然后在再头部加入 ion-back-button。
<ion-header>
  <ion-toolbar>
    <ion-title>
      Tab One
    </ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
   
  <ion-button color="primary" [routerLink]="[ '/button' ]">  跳转到按钮组件页面 </ion-button>
</ion-content>

 

相关文章:

  • 2022-01-09
  • 2021-08-01
  • 2021-11-22
  • 2021-09-02
  • 2021-10-15
  • 2021-09-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-01-22
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
相关资源
相似解决方案