首页 > 微信 > 详细

微信小程序之页面传参

时间:2019-07-20 22:38:39      阅读:114      评论:0      收藏:0      [点我收藏+]

效果图:

技术分享图片

技术分享图片

点击编辑值传过去了,那么编辑支出类型这个界面又是如何获取到值呢?

传值代码:

type.js

editType: function (e) {
   var typeId =  e.currentTarget.dataset[id];
   console.log("edit:"+typeId);


  wx.navigateTo({
    url: ../type_edit/type_edit?typeId= + typeId
  })
}

type.wxml:

<text bindtap=editType data-id="{{item.typeId}}">编辑</text>

接收值核心代码如下(这段代码通常放在onLoad函数体内):

var that = this;
   that.setData({ //this.setData的方法用于把传递过来的id转化成小程序模板语言
     typeId: options.typeId
   })

 console.log("typeId:" + that.data.typeId);

 

微信小程序之页面传参

原文:https://www.cnblogs.com/youcong/p/11215501.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!