diff --git a/src/components/userGacha/gro-data-view.vue b/src/components/userGacha/gro-data-view.vue index d0e4df06..d37ef202 100644 --- a/src/components/userGacha/gro-data-view.vue +++ b/src/components/userGacha/gro-data-view.vue @@ -52,9 +52,9 @@
-
-
-
+
+
+
@@ -155,6 +155,14 @@ onMounted(async () => { calculateHeights(); }); +watch( + () => [props.dataVal, props.dataType], + async () => { + await nextTick(); + calculateHeights(); + }, +); + function loadData(): void { title.value = getTitle(); const tempData = props.dataVal; @@ -265,12 +273,17 @@ function getStar4UpAvg(): string { // 获取占比 function getPg(star: "5" | "4" | "3"): string { let progress: number; + // 开根号 + const sq5 = Math.sqrt(star5List.value.length); + const sq4 = Math.sqrt(star4List.value.length); + const sq3 = Math.sqrt(star3count.value); + const total = sq5 + sq4 + sq3; if (star === "5") { - progress = (star5List.value.length * 100) / props.dataVal.length; + progress = (sq5 * 100) / total; } else if (star === "4") { - progress = (star4List.value.length * 100) / props.dataVal.length; + progress = (sq4 * 100) / total; } else { - progress = (star3count.value * 100) / props.dataVal.length; + progress = (sq3 * 100) / total; } if (progress === 0) return "0"; return `${progress.toFixed(2)}%`;