1、声明式导航
1.1导航到tabBar页面
tabBar页面指的是被配置为tabBar的页面
在使用<navigator>组件跳转到指定的tabBar页面时,需要指定URL (必须以 / 开头)和 open-type,其中open-type表示要跳转的方式,必须为switchTab
<navigator url = "/pages/message/message" open-type = "switchTab">导航到消息页面</navigator>
1.2 导航到非tabBar页面
非tabBar页面是指没有被配置为tabBar的页面
在使用<navigator>组件跳转到指定的tabBar页面时,需要指定URL (必须以 / 开头)和 open-type,其中open-type表示要跳转的方式,必须为navigate(navigate可以省略)
<navigator url="" open-type="navigate"></navigator>
1.3 后退导航
如果要后退到上一页面或多级页面,需要指定open-type和delta属性,其中,open-type必须是navigateBack,delta必须是数字,表示后退的层级
<navigator open-typr="navigateBack" delta=1></navigator>
如若只是后退到上一个页面,delta可以省略