// 解決首位直接輸入 '0開頭的數字'問題
this.inputModel = this.inputModel.toString() + curVal.toString()
this.inputModel = this.inputModel.replace(/[^\d.]/g,""); //清除「數字」和「.」之外的字符
this.inputModel = this.inputModel.replace(/\.{2,}/g,"."); //只保留第一個. 清除多餘的
this.inputModel = this.inputModel.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
this.inputModel = this.inputModel.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3') //保留2位小數
if(this.inputModel.indexOf(".")< 0 && this.inputModel !=""){//以上已通過濾,此處控制的是若是沒有小數點,首位不能爲相似於 0一、02的金額
this.inputModel= parseFloat(this.inputModel);
}
//判斷不能輸入最大值
if(this.maxValue > 0 && this.maxValue < this.inputModel) {
this.inputModel = this.maxValue
}
const inputVal = this.inputModel
const len = inputVal.length
if(len == 1 && inputVal.charAt(0) == '.') {
this.inputModel = ''
}