0
点赞
收藏
分享

微信扫一扫

uniapp路由跳转

Ichjns 2024-09-26 阅读 10

一、uni.navigateTo(object)

保留当前页面,跳转到指定非tabBar页面,如:

uni.navigateTo({
    url:'/pages/demo1/demo1',
})

二、uni.redirectTo(object)

关闭当前页面,跳转到指定非tabBar页面,如:

uni.redirectTo({
    url:'/pages/demo1/demo1'
})

三、uni.reLaunch(object)

关闭所有页面,打开任意指定页面,如:

uni.reLaunch({
    url:'/pages/demo1/demo1',
})

四、uni.switchTab(object)

关闭所有非tabBar页面,跳转到tabBar页面,如:

uni.switchTab({
    url:'/pages/demo2/demo2'
})

五、uni.navigateBack(object)

回退指定数量个页面,默认回退上一级,如:

uni.navigateBack()

可以通过传递对象的delta属性指定回退页面的个数,如:

//  回退两页
uni.navigateBack({
    delta:2
})

六、getCurrentPages()

获取当前所有页面的页面栈,第一个为首页,最后一个为当前页面

const pageStack = getCurrentPages()
举报

相关推荐

0 条评论