标签:ret div limit type code val ber 限制 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 ‘‘; } };
标签:ret div limit type code val ber 限制 react
原文地址:https://www.cnblogs.com/dongxiaolei/p/14373699.html