From 4a357b56c0ea39ebca5d8922d1609c1b031e443d Mon Sep 17 00:00:00 2001
From: aaron <>
Date: Sun, 22 Feb 2026 09:34:39 +0800
Subject: [PATCH] update
---
frontend/paper-trading.html | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/frontend/paper-trading.html b/frontend/paper-trading.html
index d58069b..c835b8b 100644
--- a/frontend/paper-trading.html
+++ b/frontend/paper-trading.html
@@ -1321,7 +1321,7 @@
-
+
每日收益率
@@ -1399,7 +1399,7 @@
-
+
| {{ day.date }} |
{{ day.return_percent >= 0 ? '+' : '' }}{{ day.return_percent }}%
@@ -2147,13 +2147,25 @@
if (tradingDays === 0) return 0;
const totalReturn = this.dailyReturns.reduce((sum, d) => sum + d.return_percent, 0);
return totalReturn / tradingDays;
+ },
+
+ // 显示的每日收益率(倒序,前15条)
+ displayedDailyReturns() {
+ return [...this.dailyReturns].reverse().slice(0, 15);
}
},
watch: {
- // 监听标签页切换,加载收益率数据
+ // 监听标签页切换,加载收益率数据并渲染图表
activeTab(newTab) {
- if (newTab === 'returns' && this.dailyReturns.length === 0) {
- this.fetchDailyReturns();
+ if (newTab === 'returns') {
+ if (this.dailyReturns.length === 0) {
+ this.fetchDailyReturns();
+ } else {
+ // 数据已存在,需要重新渲染图表
+ this.$nextTick(() => {
+ this.renderCharts();
+ });
+ }
}
}
}
|