微信小程序input type=“number/digit“不能输入小数
balanceInput(e) {// 获取用户输入的提现金额// let amount = parseInt(e.detail.value);let amount = e.detail.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');// 获取可提现的金额let balance = this.data.balance;const that =
·
balanceInput(e) {
// 获取用户输入的提现金额
// let amount = parseInt(e.detail.value);
let amount = e.detail.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');
// 获取可提现的金额
let balance = this.data.balance;
const that = this;
let transfinite = '';
if (amount > balance) {
transfinite = '提现金额超限';
amount = balance;
} else if (amount < 10) {
transfinite = '提现金额不少于10元';
}
// 转出金额超限 提示
that.setData({
balanceInput: amount,
transfinite
});
},
更多推荐
所有评论(0)