小程序路由传参
标签:pre json idt ima git function 目标 height event
通过路由传参的方式,会自动导入到目标页的onload的形参中;
点击页
// 父级循环 事件 点击后传的值event接受 <view wx:for="{{9}}" wx:key="{{index}}" bindtap="shijian" data-index="{{index}}"> <template is="msgItem" data="{{item}}"/> </view> //事件方法 shijian(event){ var index = event.currentTarget.dataset.index console.log(index) wx.navigateTo({ // 把参数传给点击的组件 url: ‘/pages/nav/navs?index=‘ index, }) },
访问页
死数据
let datas = require(‘这里数据‘); data: { datajson:{} }, onLoad: function (options) { let index = options.index; this.setData({ datajson:data.lest[index] }) },
喜欢的小伙伴可以关注我的微信公众号“前端伪大叔”
小程序路由传参
标签:pre json idt ima git function 目标 height event
温馨提示: 本文由杰米博客推荐,转载请保留链接: https://www.jmwww.net/weixin/15937.html
- 上一篇:微信小程序中weui使用方法
- 下一篇:小程序wxs是作用