导航页面
<template>
<view>
<view>导航跳转的学习</view>
<navigator url="../detail/detail?id=80">跳转至详情页</navigator>
<!-- 跳转到tabbar页面 需设置open-type="switchTab"-->
<navigator url="../message/message" open-type="switchTab">跳转至信息页</navigator>
<!-- 重定向跳转是没有返回箭头的 -->
<navigator url="../detail/detail" open-type="redirect">跳转至详情页</navigator>
<button @click="goDetail">跳转至详情页</button>
<button @click="gomsg">跳转至信息页</button>
<button @click="redirectgodetail">跳转至详情页并关闭当前页面</button>
</view>
</template>
<script>
export default{
methods:{
goDetail(){
// 不会关闭其他页面 导航依然存在
uni.navigateTo({
url:"../detail/detail"
})
},
gomsg(){
// 会关闭其他非tabbar页面
uni.switchTab({
url:'../message/message'
})
},
redirectgodetail(){
// 关闭当前页面并跳转
uni.redirectTo({
url:"../detail/detail?op=90"
})
}
}
}
</script>
<style>
</style>
详情页接收参数
<script>
export default{
// options就是上一个页面传过来的参数
onLoad(options) {
console.log(options)
}
}
</script>