主题
路由
设置页面
路由跳转
api
uni.switchTab(OBJECT)
:跳转到tabBar
页面,关闭其他非tabBar
页面uni.navigateTo(OBJECT)
:保留当前页面,跳转到应用内的某个页面uni.redirectTo(OBJECT)
:关闭当前页面,跳转到应用内的某个页面uni.reLaunch(OBJECT)
:关闭所有页面,打开应用内的某个页面uni.navigateBack(OBJECT)
:关闭当前页面,返回上一页面或多级页面
组件
常用参数:
url
:应用内的跳转链接,值为相对路径或绝对路径open-type
:跳转方式:switchTab
:对应uni.switchTab
navigate
:对应uni.navigateTo
redirect
:对应uni.redirectTo
reLaunch
:对应uni.reLaunch
navigateBack
:对应uni.navigateBack
exit
:退出小程序,target="miniProgram"
时生效
页面传值
js
uni.navigateTo({
url: '/pages/index/index?id=123',
})
js
onLoad(options) {
console.log(options.id)
}