let result = e.detail.value;
if (result.endsWith('.') && !isNaN(result)) {
return
}
let reg = /^(([1-9][0-9]*\.[0-9][0-9]*)|([0]\.[0-9][1-9]*)|([1-9][0-9]*)|([0]{1}))$/;
if (result.length == 0) {
this.setData({
amount: ''
})
} else if (reg.test(result)) {
this.lastValidMoney = result
this.setData({
amount: result,
})
} else {
this.setData({
amount: this.lastValidMoney
})
}
this.intervalValue(e);
input限制两位小数
最新推荐文章于 2024-06-06 16:33:14 发布