From 80190076e3ea9def23f4744d064b3a19e0756f79 Mon Sep 17 00:00:00 2001 From: ltlzx <942659938@qq.com> Date: Sun, 13 Mar 2022 15:41:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96WS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/handicap.vue | 11 ++++++----- src/views/contract/index.vue | 10 +++++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/views/contract/handicap.vue b/src/views/contract/handicap.vue index a3f9a3a..efc3e77 100644 --- a/src/views/contract/handicap.vue +++ b/src/views/contract/handicap.vue @@ -162,11 +162,11 @@ export default { }, computed: { msg() { - return { - buy: `swapBuyList_${this.symbol}`, - sell: `swapSellList_${this.symbol}`, - trade: `swapTradeList_${this.symbol}` - }; + return { + buy: `swapBuyList_${this.symbol}`, + sell: `swapSellList_${this.symbol}`, + trade: `swapTradeList_${this.symbol}` + }; }, sellListShow() { let list = this.sellList.splice(0, 12); @@ -267,6 +267,7 @@ export default { }); } }); + }, // 取消订阅 unLink(symbol) { diff --git a/src/views/contract/index.vue b/src/views/contract/index.vue index fb9ace0..3555cf7 100644 --- a/src/views/contract/index.vue +++ b/src/views/contract/index.vue @@ -130,6 +130,7 @@ :wsUrl="wsUrl" :ws="ws" class="mr-2" + ref="handicap" /> { this.swapMarketList(); }); + console.info(this.$refs) }, //三秒更新一次数据 mounted: function () { @@ -296,9 +298,15 @@ export default { this.ws.on('close',()=>{ this.ws= new Socket(this.Globals.Server.Path.WS1), console.log('链接关闭'); - this.swapMarketList(); + this.wsOpen(); }) }, + wsOpen(){ + this.ws.on("open", () => { + this.swapMarketList(); + this.$refs.handicap.linkSocket() + }); + }, // 获取合约市场 getMarketList() { Contract.getMarketList().then(res => {