react 限制小数点位数
limitDecimals = value => { const reg = /^(\-)*(\d+)\.(\d).*$/; if (typeof value === 'string') { return !isNaN(Number(value)) ? value.replace(reg, '$1$2.$3') : ''; } else if (typeof value === 'number') { return !isNaN(value) ? String(value).replace(reg, '$1$2.$3') : ''; } else { return ''; } };