课程表

微信小程序框架

微信小程序组件

微信小程序API

微信小程序开放接口

微信小程序工具

微信小程序设计规范

工具箱
速查手册

小程序 导航 navigator

当前位置:免费教程 » 移动开发 » 微信小程序

页面链接。

属性名类型默认值说明
urlString 应用内的跳转链接
open-typeStringnavigate跳转方式
deltaNumber 当 open-type 为 'navigateBack' 时有效,表示回退的层数
hover-classStringnavigator-hover指定点击时的样式类,当hover-class="none"时,没有点击态效果
hover-start-timeNumber50按住后多久出现点击态,单位毫秒
hover-stay-timeNumber600手指松开后点击态保留时间,单位毫秒

open-type 有效值:

说明最低版本
navigate对应 wx.navigateTo 的功能 
redirect对应 wx.redirectTo 的功能 
switchTab对应 wx.switchTab 的功能 
reLaunch对应 wx.reLaunch 的功能1.1.0
navigateBack对应 wx.navigateBack 的功能1.1.0

注:navigator-hover 默认为 {background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;}, <navigator/> 的子节点背景色应为透明色

示例代码:

  1. /** wxss **/
  2. /** 修改默认的navigator点击态 **/
  3. .navigator-hover {
  4. color:blue;
  5. }
  6. /** 自定义其他点击态样式类 **/
  7. .other-navigator-hover {
  8. color:red;
  9. }
  1. <!-- sample.wxml -->
  2. <view class="btn-area">
  3. <navigator url="/page/navigate/navigate?title=navigate" hover-class="navigator-hover">跳转到新页面</navigator>
  4. <navigator url="../../redirect/redirect/redirect?title=redirect" open-type="redirect" hover-class="other-navigator-hover">在当前页打开</navigator>
  5. <navigator url="/page/index/index" open-type="switchTab" hover-class="other-navigator-hover">切换 Tab</navigator>
  6. </view>
  1. <!-- navigator.wxml -->
  2. <view style="text-align:center"> {{title}} </view>
  3. <view> 点击左上角返回回到之前页面 </view>
  1. <!-- redirect.wxml -->
  2. <view style="text-align:center"> {{title}} </view>
  3. <view> 点击左上角返回回到上级页面 </view>
  1. // redirect.js navigator.js
  2. Page({
  3. onLoad: function(options) {
  4. this.setData({
  5. title: options.title
  6. })
  7. }
  8. })
转载本站内容时,请务必注明来自W3xue,违者必究。
 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号