uni-app 导航组件 navigator
navigator:页面跳转
属性说明
| 属性名 | 类型 | 默认值 | 说明 | 平台差异说明 |
|---|---|---|---|---|
| url | String | 应用内的跳转链接,值为相对路径或绝对路径,如:"../first/first","/pages/first/first",注意不能加 .vue 后缀 |
||
| open-type | String | navigate | 跳转方式 | |
| delta | Number | 当 open-type 为 'navigateBack' 时有效,表示回退的层数 | ||
| animation-type | String | pop-in/out | 当 open-type 为 navigate、navigateBack 时有效,窗口的显示/关闭动画效果,详见:窗口动画 | App |
| animation-duration | Number | 300 | 当 open-type 为 navigate、navigateBack 时有效,窗口显示/关闭动画的持续时间。 | App |
| hover-class | String | navigator-hover | 指定点击时的样式类,当hover-class="none"时,没有点击态效果 | |
| hover-stop-propagation | Boolean | false | 指定是否阻止本节点的祖先节点出现点击态 | 微信小程序 |
| hover-start-time | Number | 50 | 按住后多久出现点击态,单位毫秒 | |
| hover-stay-time | Number | 600 | 手指松开后点击态保留时间,单位毫秒 | |
| target | String | self | 在哪个小程序目标上发生跳转,默认当前小程序,值域self/miniProgram | 微信2.0.7+、百度2.5.2+、QQ |
<template>
<view>
<button type="default" @click="skip">客服页面</button>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
skip:function(){
uni.navigateTo({
url:'/pages/about/customer'
});
}
}
}
</script>
<style>
</style>
参数传递:
<script> export default { data() { return { } }, methods: { skip:function(){ uni.navigateTo({ url:'/pages/about/customer?name=kefu&age=18' }); } } } </script>
接收端:
<template>
<View>
{{name}}---{{age}}
</View>
</template>
<script>
export default {
data(){
return{
age:'',
name:''
}
},
onLoad: function (option) { //option为object类型,会序列化上个页面传递的参数
console.log(option.age); //打印出上个页面传递的参数。
console.log(option.name); //打印出上个页面传递的参数。
this.age=option.age;
this.name=option.name;
}
}
</script>
<style>
</style>


浙公网安备 33010602011771号