onInput(value) {
if (value) {
let temp = value.toString();
temp = temp.replace(/^0{2,}/g,'')
temp = temp.replace(/。/g, ".");
temp = temp.replace(/[^\d.]/g, ""); //清除"数字"和"."以外的字符
temp = temp.replace(/^\./g, ""); //验证第一个字符是数字
temp = temp.replace(/\.{2,}/g, ""); //只保留第一个, 清除多余的
temp = temp.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
temp = temp.replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3"); //只能输入两个小数
this.$nextTick(() => {
if (temp.includes('.') && temp.indexOf('.') > 6) {
temp = temp.slice(0, 6)
}
if (!temp.includes('.') && temp.length > 6) {
temp = temp.slice(0, 6)
}
this.value = temp
})
}
},