微信小程序获取input框的值

html

用户名:
bindinput ="userNameInput"/>

密 码:
bindinput="passWdInput" />



 

js

// pages/index/login.js
Page({
data: {
userName: '',
userPwd:""
},
//获取用户输入的用户名
userNameInput:function(e)
{
this.setData({
userName: e.detail.value
})
},
passWdInput:function(e)
{
this.setData({
userPwd: e.detail.value
})
},
//获取用户输入的密码
loginBtnClick: function (e) {
console.log("用户名:"+this.data.userName+" 密码:" +this.data.userPwd);
}
,
// 用户点击右上角分享
onShareAppMessage: function () {

}
})

转载于:https://www.cnblogs.com/chanhxy/p/9056167.html

你可能感兴趣的:(微信小程序获取input框的值)