微信小程序之页面传参
发布时间:2020-12-14 19:01:16 所属栏目:资源 来源:网络整理
导读:效果图: 点击编辑值传过去了,那么编辑支出类型这个界面又是如何获取到值呢? 传值代码: type.js editType: function (e) { var typeId = e.currentTarget.dataset[ ' id ' ]; console.log( " edit: " + typeId); wx.navigateTo({ url: ../type_edit/type_ed
效果图: 点击编辑值传过去了,那么编辑支出类型这个界面又是如何获取到值呢? 传值代码: 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); ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |