UI框架用的是微赞
例子:
login.wxml
<van-cell-group><van-fieldvalue="{{ ei_code }}"bind:change="getEi_code"clearableleft-icon="shop-o"placeholder="请输入商家编号"/><van-fieldvalue="{{ us_code }}"bind:change="getUs_code" clearableleft-icon="user-o"placeholder="请输入用户编号"/><van-fieldvalue="{{ us_pwd }}"bind:change="getUs_pwd"type="password"left-icon="bag-o"placeholder="请输入密码"/></van-cell-group>
login.js
var that;
Page({data: {ei_code: '',us_code: '',us_pwd: ''},onLoad:function(){that = this;},openIndex(){wx.showToast({title: "商家编号:"+this.data.ei_code+" 用户编号:" +this.data.us_code+" 密码" +this.data.us_pwd,icon: 'none',duration: 2000})console.log("商家编号:"+this.data.ei_code+" 用户编号:" +this.data.us_code+" 密码" +this.data.us_pwd);},getEi_code(event) {that.setData({ei_code: event.detail});},getUs_code(event) {that.setData({us_code: event.detail});},getUs_pwd(event) {that.setData({us_pwd: event.detail});}})
注意事项:that和this的区别,在输入框上绑定事件(当内容改变时赋值)。