方式一:
- 通过<form bindsubmit="formSubmit">与<button formType="submit">标签配合使用
- js取值:
formSubmit: function(e) {
// detail
var detail = e.detail.value.detail;
// realname
var realname = e.detail.value.realname;
// mobile
var mobile = e.detail.value.mobile;
}
方式二:
- 通过<input bindconfirm="realnameConfirm">实现
!!bindconfirm 是全部完成后 再传数据!!
detailConfirm:function(e) {
var detail = e.detail.value;
}
realnameConfirm: function(e) {
var realname = e.detail.value;
}
mobileConfirm: function(e) {
var mobile = e.detail.value;
}
方式三:
- 通过<input bindinput="bindInput" />实现
<input type="number" placeholder="请输入手机号" class="inp-holder" maxlength="11" bindinput="getPhone" />
getPhone: function (e) {
var val = e.detail.value;
this.setData({
telphone: val
});
},