属性 | 类型 | 默认值 | 必填 | 说明 |
target | string | self | - | 在哪个目标上发生跳转,默认当前小程序,可选值 self/miniProgram |
url | string | - | 否 | 当前小程序内的跳转 |
open-type | string | navigate | 否 | 跳转方式 |
path | string | - | - | 当 target="miniProgram"时有效,打开的页面路径,如果为空则打开首页 |
extra-data |
object
| - | - | 当 target="miniProgram"时有效,需要传递给目标小程序的数据,目标小程序可在 App.onLaunch() ,App.onShow() 中获取到这份数据。 |
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"时有效,跳转小程序完成 |
aria-label | string | - | - | 无障碍访问,(属性)元素的额外描述 |
合法值 | 说明 |
navigate | 对应 wx.navigateTo 或 wx.navigateToMiniProgram 的功能 |
redirect | 对应 wx.redirectTo 的功能 |
switchTab | 对应 wx.switchTab 的功能 |
reLaunch | 对应 wx.reLaunch 的功能 |
navigateBack | 对应 wx.navigateBack 的功能 |
fail cancel
。navigator-hover
默认为{background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;},<navigator>
的子节点背景色应为透明色。/** wxss **//** 修改默认的navigator点击态 **/.navigator-hover {color: blue;}/** 自定义其他点击态样式类 **/.other-navigator-hover {color: red;}
<!-- sample.wxml --><view class="btn-area"><navigatorurl="/page/navigate/navigate?title=navigate"hover-class="navigator-hover">跳转到新页面</navigator><navigatorurl="../../redirect/redirect/redirect?title=redirect"open-type="redirect"hover-class="other-navigator-hover">在当前页打开</navigator><navigatorurl="/page/index/index"open-type="switchTab"hover-class="other-navigator-hover">切换 Tab</navigator></view>
<!-- navigator.wxml --><view style="text-align:center">{{title}}</view><view>点击左上角返回回到之前页面</view>
// redirect.js navigator.jsPage({onLoad(options) {this.setData({title: options.title})}})
本页内容是否解决了您的问题?