首页 > 编程语言 >关于声明式导航和编程式导航到tabBar页面和非tabBar页面

关于声明式导航和编程式导航到tabBar页面和非tabBar页面

时间:2023-01-29 16:35:31浏览次数:55  
标签:导航 type tabBar 跳转 open 页面

声明式导航到tabBar页面

<navigator url="/***/***/**" open-type="switchTab"></navigator >

注意点url和open-type为必填

1. 指定url跳转的页面地址,以/开头

2.open-type为跳转方式,值必须为switchTab

导航至非tabBar页面的话

1. 指定url跳转的页面地址,以/开头

2.open-type为跳转方式,值必须为navigate,(可省略)

声明式后退导航(只能在非tabBar页面回退,tabBar中不可以)

 <navigator  open-type="navigateBack" delta="1"></navigator >

  • open-type 的值必须是 navigateBack,表示要进行后退导航

  • delta 的值必须是数字,表示要后退的层级

编程式导航到tabBar页面

 

 

 在页面中定义事件,在事件中调用wx.switchTab({url:'/**/**/**'})

导航至非tabBar调用wx.navigateTo(Object object)

 

 注意:当使用wx.navigateTo跳转到tabbar页面时,会触发fail事件。

编程式后退导航

 

 

在onLoad中接收页面跳转参数

 

标签:导航,type,tabBar,跳转,open,页面
From: https://www.cnblogs.com/harryzong/p/17072849.html

相关文章