1、傳值:index下標傳值、頁面navigator傳值 1、index下標 實現方式是:data-index="{{index}}"挖坑及e.currentTarget.dataset.index來填坑即可 2、<navigator>標簽 <navigator url="../enlist/enlist?unitPrice={{common.act_fee}}&is_home=0&a_id={{common.a_id}}"> 或者 <view class="container" data-index="{{index}}" bindtap="edit"><image src="../../../images/icon_edit.png" /><text>編輯</text></view> edit: function (e) { var that = this; // 取得下標 wx.navigateTo({ url: '../add/add?objectId='+objectId }); },
2、取值:form表單取值、input框綁定取值 1、 form表單取值 1.1 方式一,通過<form bindsubmit="formSubmit">與<button formType="submit">標簽配合使用 formSubmit: function(e) { // detail var detail = e.detail.value.detail; // realname var realname = e.detail.value.realname; // mobile var mobile = e.detail.value.mobile; } 2、方式二,通過<input bindblur="realnameConfirm">實現:失去焦點bindblur、數值變化bindchange等方法 realnameConfirm: function(e) { var that = this; that.setData({ realname:e.detail.value }) } //然后可以在頁面其他地方用到了,改校驗的校驗,改發(fā)送給后臺的發(fā)送,等等
微信小程序輸入框input
|