1
This commit is contained in:
parent
1de64df2dc
commit
a83000075c
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user