chore: using includes instead of indexOf (#8261)

This commit is contained in:
neverland
2021-03-04 11:07:54 +08:00
committed by GitHub
parent 831091182a
commit 9fd71923f9
13 changed files with 31 additions and 31 deletions

View File

@@ -190,7 +190,7 @@ export default createComponent({
let formatted = formatNumber(String(value), !props.integer);
// limit max decimal length
if (isDef(decimalLength) && formatted.indexOf('.') !== -1) {
if (isDef(decimalLength) && formatted.includes('.')) {
const pair = formatted.split('.');
formatted = `${pair[0]}.${pair[1].slice(0, +decimalLength)}`;
}