实现如下转化
1.266279E3 || 1.266279e3 =>1266.279
1.9E-5 || 1.9e-5 =>0.000019
12345=>12345
0.123=>0.123
/**
* 判断值是否为科学计数法并转化
*/
translation(cellValue){
let num = Number(cellValue);
//判断数值是否为科学计数法
let science = !isNaN(num) && String(num).toLowerCase().includes("e")
if (science) {
return this.convertNum(cellValue);
} else {
return cellValue
}
},
/**
* 科学计数法转数字
*/
convertNum(x) {
if (Math.abs(x) < 1.0) {
let e = parseInt(x.toString().split('e-')[1]);
if (e) {
x *= Math.pow(10, e - 1);
x = '0.' + (new Array(e)).join('0') + x.toString().substring(2);
}
} else {
let e = parseInt(x.toString().split('+')[1]);
if (e > 20) {
e -= 20;
x /= Math.pow(10, e);
x += (new Array(e + 1)).join('0');
}
}
return x;
}