自学内容网 自学内容网

uniapp路由跳转

一、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()


原文地址:https://blog.csdn.net/weixin_74261199/article/details/142481030

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!