小程序之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>

此文是我看到觉得蛮不错的文章,特地来此分享给大家!

附上原文链接,尊重他人劳动成果耶!

原文链接:https://www.cnblogs.com/ishoulgodo/p/13875213.html

原文地址:https://www.cnblogs.com/ZXH-null/p/14109356.html