码迷,mamicode.com
首页 > 微信 > 详细

小程序之页面跳转

时间:2020-03-31 21:06:02      阅读:87      评论:0      收藏:0      [点我收藏+]

标签:type   launch   src   width   http   ima   官方   back   微软雅黑   

微信小程序中,执行多个页面间跳转的方式有如下4种:

小程序官方文档的路由触发方式如下:

技术图片

注意的是,各种跳转方式在跳转结束以后原页面和现页面的状态各不相同:

  • wx.navigateTo({url:url})     导航到,跳转到指定页面,原页面隐藏
    •   wx.navigateBack( )    导航返回,原页面重新显示,跳转的页面被销毁
  • wx.redirectTo({url:url})     重定向到指定页面 ,原页面被销毁
  • wx.switchTab({url:url})      切换到标签页(上面两种方法都无法跳转到标签页),原页面被销毁
  • wx.reLaunch({url:url})     重新加载,原页面被销毁  

使用组件:<navigator url=""  open-type="navigateTo/navigateBack/redirectTo/switchTab/reLaunch">跳转</navigator>

 

小程序之页面跳转

标签:type   launch   src   width   http   ima   官方   back   微软雅黑   

原文地址:https://www.cnblogs.com/codexlx/p/12608058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!