<input type="digit" placeholder="请输入分享赚¥:" bindinput="onShare" model:value="{{amount}}" />
onShare(e) {
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
})
}
},