export const numInputInput = (value, len = 5, decimals = 1) => { // value:修改的数字 len 总长度 decimals:允许小数点后几位 //todo 5位整数数加一位小数 value += ""; if (value.length == 0) return null; let index = value.lastIndexOf("."); if (index != -1) { let [int, dec] = value.split("."); if (dec.length > decimals) { dec = dec.slice(0, dec.length - 1); } if (int.length > len) { int = int.slice(0, int.length - 1); } return parseFloat(int + "." + dec); } if (value.length > len) { value = value.slice(0, value.length - 1); } return parseFloat(value); }