处理数据
This commit is contained in:
@@ -31,12 +31,13 @@ export default {
|
||||
},
|
||||
getValue(item) {
|
||||
let result = this.info[item.prop]
|
||||
if (item.unit == "%") result = (result * 100 || 0) + "%"
|
||||
if (item.unit == "%") result = (result * 100 || 0).toFixed(2) + "%"
|
||||
if (item.calc) result = item.calc()
|
||||
if (/^-?\d+(\.\d+)?$/.test(result)) result = Number(result).toFixed(2)
|
||||
return result
|
||||
},
|
||||
getIncrement(item) {
|
||||
let result = this.info[item.prop + "Diff"] || ""
|
||||
let result = Number(this.info[item.prop + "Diff"] || 0).toFixed(2) || ""
|
||||
if (result > 0) result = "↑" + result
|
||||
else if (result < 0) result = "↓" + result
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user