下面是js代码:
cashmoney: function (e) {
var that = this;
var amounts = that.data.amounts;
var money = that.data.money;
console.log(that.data.amounts + "============================" + that.data.money)
console.log(that.data.amounts>that.data.money)
if (!(/^$|^([0-9]{1}|[1-9]+\d*)(.{0,1}\d{1,2})?$/.test(that.data.amounts)) || that.data.amounts.substring(0, 1) == 0 || amounts > money) {
wx.showToast({
icon: "none",
title: '请输入合理的金额!',
duration:1500
})
}else{
console.log(app.globalData.weixinAccount+"============================"+app.globalData.zhifubaoAccount)
}
}
这是输入框:
<view class="cash-money">
<input type="digit" placeholder="请输入要提现的金额" bindinput="moneyinput" value="{{amounts}}"></input>
</view>
这是输出结果,