tencent cloud

导航组件
最后更新时间:2024-11-27 18:07:37
导航组件
最后更新时间: 2024-11-27 18:07:37
功能说明:页面链接。
参数及说明:
属性
类型
合法值及说明
默认值
必填
说明
target
string
self:当前小程序
miniProgram:其他小程序
self
在哪个目标上发生跳转,默认当前小程序
url
string
-
-
当前小程序内的跳转
open-type
string
navigate:对应 wx.navigateTo 或 wx.navigateToMiniProgram 的功能
redirect:对应 wx.redirectTo 的功能
switchTab:对应 wx.switchTab 的功能
reLaunch:对应 wx.reLaunch 的功能
navigateBack:对应 wx.navigateBack 的功能
exit:退出小程序,target="miniProgram"时生效
navigate
跳转方式
delta
number
-
1
当 open-type 为 'navigateBack' 时有效,表示回退的层数
app-id
string
-
-
当 target="miniProgram"且 open-type="navigate"时有效,要打开的小程序 appId
path
string
-
-
当 target="miniProgram"时有效,打开的页面路径,如果为空则打开首页
extra-data
object
-
-
当 target="miniProgram"时有效,需要传递给目标小程序的数据,目标小程序可在App.onLaunch()App.onShow() 中获取到这份数据。
version
string
develop:开发版
trial:体验版
release:正式版,仅在当前小程序为开发版或体验版时此参数有效;如果当前小程序是正式版,则打开的小程序必定是正式版
release
当 target="miniProgram"且 open-type="navigate"时有效,要打开的小程序版本
hover-class
string
-
navigator-hover
指定点击时的样式类,当hover-class="none"时,没有点击态效果
hover-stop-propagation
boolean
-
false
指定是否阻止本节点的祖先节点出现点击态
hover-start-time
number
-
50
按住后多久出现点击态,单位毫秒
hover-stay-time
number
-
600
手指松开后点击态保留时间,单位毫秒
bindsuccess
string
-
-
当 target="miniProgram"时有效,跳转小程序成功
bindfail
string
-
-
当 target="miniProgram"时有效,跳转小程序失败
bindcomplete
string
-
-
当 target="miniProgram"时有效,跳转小程序完成
使用限制:需要用户确认跳转
在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转至其他小程序。如果用户单击取消,则回调fail cancel
注意:
navigator-hover默认为{background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;}, <navigator>的子节点背景色应为透明色。
示例代码:
sample.wxml
navigator.wxml
redirect.wxml
JAVASCRIPT
WXSS
<view class="btn-area">
<navigator
url="/page/navigate/navigate?title=navigate"
hover-class="navigator-hover"
>
跳转到新页面
</navigator>
<navigator
url="../../redirect/redirect/redirect?title=redirect"
open-type="redirect"
hover-class="other-navigator-hover"
>
在当前页打开
</navigator>
</view>
<view style="text-align:center"> {{title}} </view>
<view> 点击左上角返回回到之前页面 </view>
<view style="text-align:center"> {{title}} </view>
<view> 点击左上角返回回到上级页面 </view>
Page({
onLoad: function(options) {
this.setData({
title: options.title
})
}
})
/** wxss **/
/** 修改默认的navigator点击态 **/
.navigator-hover {
color: blue;
}
/** 自定义其他点击态样式类 **/
.other-navigator-hover {
color: red;
}



本页内容是否解决了您的问题?
您也可以 联系销售 提交工单 以寻求帮助。

文档反馈