From 2364af09b4046c1cb0d4b6a6c8f2add5e3a11b93 Mon Sep 17 00:00:00 2001 From: TorsenLi Date: Wed, 10 Jun 2026 18:27:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E8=82=A1=E7=A5=A8=E7=AC=A6=E5=8F=B7=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=BB=A5=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/exchangeStock/index.vue | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/views/exchangeStock/index.vue b/src/views/exchangeStock/index.vue index 1a1c269..fcb62b9 100644 --- a/src/views/exchangeStock/index.vue +++ b/src/views/exchangeStock/index.vue @@ -391,6 +391,17 @@ }, methods: { + initDefaultSymbol(marketList) { + if (this.symbol || !marketList || !marketList.length) return; + const firstGroup = marketList[0]; + const first = firstGroup && firstGroup.marketInfoList && firstGroup.marketInfoList[0]; + if (!first) return; + this.symbol = first.symbol; + this.findMarketBySymbol(); + if (this.ws && this.ws.socket && this.ws.socket.readyState === WebSocket.OPEN) { + this.addSub(); + } + }, ispopover1(item){ this.symbol=item; }, @@ -643,9 +654,9 @@ this.marketList = data; - if (!this.symbol) { // 默认symbol 重新请求数据 - this.symbol = _.nth(data).marketInfoList[0].symbol; - } else { // 找出该symbol对应的记录并更新页面 + if (!this.symbol) { + this.initDefaultSymbol(data); + } else { this.findMarketBySymbol(); } @@ -698,9 +709,7 @@ Market.getstockMarketList().then(data => { this.marketList = data; - // if (!this.symbol) { // 默认symbol 重新请求数据 - // this.symbol = _.nth(data).marketInfoList[0].symbol; - // } + this.initDefaultSymbol(data); }).catch(err => {}); // this.update(); },