当前位置: 代码迷 >> 综合 >> 微信小程序获取input
  详细解决方案

微信小程序获取input

热度:52   发布时间:2024-01-20 01:05:42.0

首先给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

  相关解决方案