微信小程序导航 navigator


当前第2页 返回上一页

open-type 有效值:

说明 最低版本
navigate 对应wx.navigateTo的功能  
redirect 对应wx.redirectTo的功能  
switchTab 对应wx.switchTab的功能  
reLaunch 对应wx.reLaunch的功能 1.1.0
navigateBack 对应wx.navigateBack的功能 1.1.0
exit
退出小程序,target="miniProgram"时生效
2.1.0

注: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">
  <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>
<!-- navigator.wxml -->
<view style="text-align:center"> {{title}} </view>
<view> 点击左上角返回回到之前页面 </view>
<!-- redirect.wxml -->
<view style="text-align:center"> {{title}} </view>
<view> 点击左上角返回回到上级页面 </view>
// redirect.js navigator.js
Page({
  onLoad: function(options) {
    this.setData({
      title: options.title
    })
  }
})



标签:微信小程序

返回前面的内容

相关阅读 >>

微信小程序工具 设置

微信小程序api 实时语音-更新静音设置

微信小程序绘图api中创建二次方贝塞尔曲线

微信小程序视图容器 cover-view

微信小程序 页面路由

微信小程序 扫码支付

微信小程序 服务市场invokeservice

微信小程序云开发sdk文档 微信支付申请退款

微信小程序 component构造器

微信小程序 sitemap配置

更多相关阅读请进入《微信小程序》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...