微信小程序> 微信小程序跳转,微信小程序页面跳转的方法总结

微信小程序跳转,微信小程序页面跳转的方法总结

浏览量:1192 时间: 来源:Ordinary-life
利用小程序提供的API跳转://保留当前页面,跳转到应用内的某个页面,使用wx.navigateBack可以返回到原页面。//注意:调用navigateTo跳转时,调用该方法的页面会被加入堆栈,但是redirectTowx.navigateTo({url:‘page/home/home?user_id=111’})
//关闭当前页面,返回上一页面或多级页面。可通过getCurrentPages()获取当前的页面栈,决定需要返回几层。wx.navigateTo({url:‘page/home/home?user_id=111’//页面A})wx.navigateTo({url:‘page/detail/detail?product_id=222’//页面B})//跳转到页面Awx.navigateBack({delta:2})
//关闭当前页面,跳转到应用内的某个页面。wx.redirectTo({url:‘page/home/home?user_id=111’})
//跳转到tabBar页面(在app.json中注册过的tabBar页面),同时关闭其他非tabBar页面。wx.switchTab({url:‘page/index/index’})
//关闭所有页面,打开到应用内的某个页面。wx.reLanch({url:‘page/home/home?user_id=111’})
wxml页面组件跳转(可以通过设置open-type属性指明页面跳转方式)://navigator组件默认的open-type为navigatenavigatorurl="/page/navigate/navigate?title=navigate"hover-跳转到新页面/navigator//redirect对应API中的wx.redirect方法navigatorurl="../../redirect/redirect/redirect?title=redirect"open-type="redirect"hover-在当前页打开/navigator//switchTab对应API中的wx.switchTab方法navigatorurl="/page/index/index"open-type="switchTab"hover-切换Tab/navigator
//reLanch对应API中的wx.reLanch方法navigatorurl="../../redirect/redirect/redirect?title=redirect"open-type="redirect"hover-关闭所有页面,打开到应用内的某个页面/navigator//navigateBack对应API中的wx.navigateBack方法navigatorurl="/page/index/index"open-type="navigateBack"hover-关闭当前页面,返回上一级页面或多级页面/navigator

版权声明

即速应用倡导尊重与保护知识产权。如发现本站文章存在版权问题,烦请提供版权疑问、身份证明、版权证明、联系方式等发邮件至197452366@qq.com ,我们将及时处理。本站文章仅作分享交流用途,作者观点不等同于即速应用观点。用户与作者的任何交易与本站无关,请知悉。

产品经理

手机 : 13312967497

擅长 : 小程序流量变现

扫码领取礼包

热门模板

  • 头条
  • 搜狐
  • 微博
  • 百家
  • 一点资讯
  • 知乎