目录
一、概念
页面导航就是实现页面之间的相互跳转。
(一)声明式导航
- 在页面上声明一个navigator
- 通过点击<navigator>组件实现页面跳转
(1)导航到tabBar页面
使用<navigator>组件跳转到指定的tabBar页面,在这个过程中要指定url和open-type属性。
注意:
- url表示的是要跳转的页面的地址,且必须以/开头
- open-type表示跳转的方式,必须为switchTab
<navigator url="/pages/message/message" open-type="switchTab">导航到消息页面</navigator>
(2)导航到非tabBar页面
使用<navigator>组件跳转到非tabBar页面,在这个过程中要指定url和open-type属性。
- url表示的是要跳转的页面的地址,且必须以/开头
- open-type表示跳转的方式,必须为navigate
<navigator url="/pages/test/test" open-type="navigate">导航到test页面</navigator>
注意:open-type="navigate"可以省略