小程序-数据双向绑定

wxml

view>手机号:</view>
<input value="{{phone}}" bindinput="bindPhone" placeholder="请输入手机号"></input>

<view>验证码:
  <text>点击获取验证码</text>
</view>
<input value="{{code}}" bindinput="bindCode" placeholder="请输入验证码"></input>

js


  data: {
    phone:"",
    code:""
  },
  bindPhone:function(e){
    this.setData({phone:e.detail.value});
  },
  bindCode:function(e){
    this.setData({code:e.detail.value});
  },

 

posted @ 2020-05-12 11:53  南啾  阅读(2514)  评论(0编辑  收藏  举报