一个小错误:
在input框输入的时候,把绑定事件写成了bindtap,所以一直无法将值输入到e.detail.value,所以一直提示错误,真傻呀
wxml
<view class="row">
<text>验证码</text>
<input value="{{code}}" placeholder="请输入验证码" bindinput="bindCode" placeholder-class="txt" maxlength="4" > </input>
<view class="box" bindtap="get_code" >获取验证码</view>
</view>
js
data: {
phone:"",
code:""
},
bindPhone:function(e){
console.log(e)
this.setData({"phone":e.detail.value})
console.info(this.data.phone)
},
结果: