微信小程序页面跳转传递值
来源:互联网 发布:什么是数据冗余 编辑:程序博客网 时间:2024/06/05 16:26
微信小程序导航有两种形式:一种是在写在js中进行跳转,另一种是写在wxml页面中进行跳转。
1、js导航
(1)、wx.navigateTo(OBJECT) :保留当前页面,跳转到应用内的某个页面,使用wx.navigateBack可以返回到原页面。
wx.navigateTo({ url: 'test?id=1'})获取传递的值:
//test.jsPage({ onLoad: function(option){ console.log(option.id) }})
(2)、wx.redirectTo(OBJECT):关闭当前页面,跳转到应用内的某个页面。
wx.redirectTo({ url: 'test?id=1'})
(3)、wx.navigateBack(OBJECT):关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages()) 获取当前的页面栈,决定需要返回几层。
2、wxml导航
navigator:页面链接。
注: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;}
<view class="btn-area"> <navigator url="navigate?title=navigate" hover-class="navigator-hover">跳转到新页面</navigator> <navigator url="redirect?title=redirect" redirect hover-class="other-navigator-hover">在当前页打开</navigator></view>
// redirect.js navigator.jsPage({ onLoad: function(options) { this.setData({ title: options.title }) }})
0 0
- 微信小程序页面跳转传递值
- 微信小程序页面跳转传递值
- 微信小程序 页面跳转 传递参数
- 微信小程序 页面跳转 传递参数
- 微信小程序 页面跳转与参数传递
- 微信小程序 页面跳转 传递参数
- 微信小程序的页面跳转和参数传递,页面生命周期
- 【微信小程序】微信小程序页面跳转的数据传递
- 微信小程序 页面跳转和数据传递实例详解
- 微信小程序页面跳转传递Json对象参数
- [微信小程序]页面跳转对象参数的传递方法
- 小程序跳转页面传递参数2
- 微信小程序-页面跳转
- 微信小程序:页面跳转
- 微信小程序页面跳转
- 微信小程序,页面跳转
- 微信小程序页面跳转
- 微信小程序的页面跳转和参数传递 —— 微信小程序教程系列(6)
- 如何提高自己的设计水平(三)
- git-svn 'path probably does not exist' 错误
- 读《TCP/IP详解》第19、20章:TCP的数据流
- mysql相关查询语法
- llinux上发布系统的流程
- 微信小程序页面跳转传递值
- Apache服务器安装
- CM系统应用源码分析与rom定制
- Android五大存储方式之File文件存储
- Android的FastBoot的安装与环境变量设置
- android预装内置可卸载的应用
- IOS IPV6域名转IP
- Android多线程我该如何理解
- 正则表达式