From beaef5c59a8e49d448e3cd5ec477654c024999f8 Mon Sep 17 00:00:00 2001 From: jiaming743 <743192023@qq.com> Date: Tue, 16 Jun 2020 14:24:02 +0800 Subject: [PATCH] optmization --- src/components/scrollRankingBoard/src/main.vue | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/scrollRankingBoard/src/main.vue b/src/components/scrollRankingBoard/src/main.vue index e822906..683e76b 100644 --- a/src/components/scrollRankingBoard/src/main.vue +++ b/src/components/scrollRankingBoard/src/main.vue @@ -155,15 +155,14 @@ export default { const min = Math.min(...value) || 0 - //最小值的绝对值 + // abs of min const minAbs = Math.abs(min) const max = Math.max(...value) || 0 - //最小值的绝对值 + // abs of max const maxAbs = Math.abs(max) - //总数为最大值与最小值的绝对值相加 const total = max + minAbs data = data.map((row, i) => ({ ...row, ranking: i + 1, percent: (row.value + minAbs) / total * 100 }))