This commit is contained in:
aaron 2026-02-23 00:30:45 +08:00
parent 1de64df2dc
commit a83000075c

View File

@ -457,20 +457,20 @@
<button
class="tab"
:class="{ active: currentTab === 'positions' }"
@click="currentTab = 'positions'">
@click="switchTab('positions')">
交易所持仓 ({{ exchangePositions.length }})
</button>
<button
class="tab"
:class="{ active: currentTab === 'trades' }"
@click="currentTab = 'trades'">
成交记录
@click="switchTab('trades')">
成交记录 ({{ tradeHistory.length }})
</button>
<button
class="tab"
:class="{ active: currentTab === 'orders' }"
@click="currentTab = 'orders'">
历史订单
@click="switchTab('orders')">
历史订单 ({{ orderHistory.length }})
</button>
</div>
@ -650,6 +650,23 @@
}
},
methods: {
async switchTab(tab) {
if (this.currentTab === tab) return; // 已经是当前标签,不重新加载
this.currentTab = tab;
// 切换标签时加载对应数据
this.loading = true;
try {
if (tab === 'trades') {
await this.fetchTradeHistory();
} else if (tab === 'orders') {
await this.fetchOrderHistory();
}
} finally {
this.loading = false;
}
},
async refreshData() {
this.loading = true;
try {