微信小程序获取input

首先给input添加事件

< view class= "field clearfix">

< input id= "name" name= "Phone" class= "login-input" type= "text" placeholder= "请输入手机号" bindinput= "getPhone" / >

</ view >


//添加bindinput="getPhone"


data: {
Phone: 1,
},

//获取用户输入的用户名
getPhone: function (e) {
this.setData({
Phone: e.detail.value
})
},


接下来就是把获取到的值写入data的phone

猜你喜欢

转载自blog.csdn.net/servicesyy/article/details/80625305