navigator
页面链接。
属性
支持通用属性
| 属性名 | 类型 | 默认值 | 说明 | 平台支持 |
|---|---|---|---|---|
| url | String | 应用内的跳转链接 | all | |
| open-type | String | navigate | 跳转方式 | all |
| delta | Number | 当 open-type 为 'navigateBack' 时有效,表示回退的层数 | u?,w | |
| hover-class | String | navigator-hover | 指定点击时的样式类,当hover-class="none"时,没有点击态效果 |
u?,w,a |
| hover-start-time | Number | 50 | 按住后多久出现点击态,单位毫秒 | u?,w,a |
| hover-stay-time | Number | 600 | 手指松开后保留时间,单位毫秒 | u?,w,a |
open-type 有效值:
| 值 | 说明 |
|---|---|
| navigate | 对应uni.navigateTo的功能 |
| redirect | 对应uni.redirectTo的功能 |
| switchTab | 对应uni.wwitchTab的功能 |
| reLaunch | 对应uni.reLaunch的功能 |
| navigateBack | 对应uni.navigateBack的功能 |
注:navigator-hover默认为{background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;},<navigator/>的子节点背景色应为透明色
事件
支持通用事件
示例
<!-- sample.nml -->
<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>
<navigator url="/page/index/index" open-type="switchTab" hover-class="other-navigator-hover">切换 Tab</navigator>
</view>