小程序之navigator跳转方式

navigator中的open-type可以决定小程序的跳转方式;
是否关闭当前页面
或者说以何种方式进行跳转
 标签<navigator>中 open-type属性表示小程序的跳转方式;
 open-type='redirectTo'
 open-type='navigateTo'
 还有其他的跳转方式
 地址: https://developers.weixin.qq.com/miniprogram/dev/component/navigator.html


 redirectTo:关闭当前页面,跳转到应用内的某个页面。
 但是不允许跳转到 tabbar 页面
 <navigator url="/pages/index/index" open-type='redirectTo'>跳转</navigator>



navigateTo:保留当前页面,跳转到应用内的某个页面。
但是不能跳到 tabbar 页面。
使用 wx.navigateBack 可以返回到原页面。
小程序中页面栈最多十层。(特别重要)
open-type=navigate是它的默认跳转方式是 保留当前页面跳转到另外一个页面


<navigator url="/pages/index/index" open-type='navigateTo'>跳转</navigator>
posted @ 2020-10-25 21:03  何人陪我共长生  阅读(1417)  评论(0编辑  收藏  举报