文章摘要:小程序如何获取页面上多个input值 小程序获取input内容
小程序获取页面上多个input值的案例: //wxml <input class= […]
小程序获取页面上多个input值的案例:
//wxml
<input class="formInput" placeholder="请输入旧密码" password placeholder-class="placeholderStyle" bindinput='inputWacth' data-model="oldPassword"> </input>
<input class="formInput" placeholder="请输入新密码" password placeholder-class="placeholderStyle" bindinput='inputWacth' data-model="newPassword"></input>
//js
data: {
oldPassword:'',
newPassword:''
},
inputWacth:function(e){
console.log(e);
let item = e.currentTarget.dataset.model;
this.setData({
[item]: e.detail.value
});
},