From 1ddf8a87f8ee5ca2ac435c2096c69091b61fd4ac Mon Sep 17 00:00:00 2001 From: liaoxinyu Date: Mon, 15 Apr 2024 09:37:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9k=E7=BA=BF=E5=92=8C=E5=8F=B3?= =?UTF-8?q?=E8=BE=B9=E7=9A=84=E4=BB=B7=E6=A0=BC=E4=B8=80=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/handicap.vue | 21 ++++++++++++++------- src/views/contract/index.vue | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/views/contract/handicap.vue b/src/views/contract/handicap.vue index 6554d1a..968a3af 100644 --- a/src/views/contract/handicap.vue +++ b/src/views/contract/handicap.vue @@ -199,10 +199,17 @@ export default { this.linkSocket(); } bus.$on('collapse', msg => { - // this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3); - // this.newPriceObj.price = msg.close; - // this.$emit("input", this.newPriceObj); + this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3); + if (msg.close.endsWith('.')) { + // 如果是整数,添加一个'0'到字符串末尾 + msg.close += '0'; + } + this.newPriceObj.price = msg.close; + this.$emit("input", this.newPriceObj); // console.log(this.newPriceObj.price, 'this.newPriceObj.price-----') + // const closeStr = msg.close.toString(); + // this.newPriceObj.price = this.symbol === 'BTC' ? closeStr.slice(0, closeStr.indexOf('.') + 2) : closeStr.slice(0, closeStr.indexOf('.') + 4); + // this.$emit("input", this.newPriceObj); }); }, // 获取盘口 @@ -217,9 +224,9 @@ export default { this.sellList = res.swapSellList; this.buyList = res.swapBuyList; this.tradeList = res.swapTradeList; - if(this.tradeList.length>0){ + // if(this.tradeList.length>0){ this.newPriceObj = this.tradeList[0]; - } + // } this.$emit("input", this.newPriceObj); }); }, @@ -272,8 +279,8 @@ export default { // console.log('if (sub == this.msg.trade)', this.msg.trade) this.tradeList.unshift(data); this.tradeList.pop(); - this.newPriceObj = data; - this.$emit("input", this.newPriceObj); + // this.newPriceObj = data; + // this.$emit("input", this.newPriceObj); } else if (type == "ping" ||cmd == "ping") { this.ws.send({ cmd: "pong" diff --git a/src/views/contract/index.vue b/src/views/contract/index.vue index d921bbf..cd020bc 100644 --- a/src/views/contract/index.vue +++ b/src/views/contract/index.vue @@ -264,7 +264,7 @@ export default { this._time = setInterval(() => { if (this.contractOpen) { // mounted 中有定时器跑holdPosition了 - // this.holdPosition(); + this.holdPosition(); } }, 3000); this.ws.on("open", () => {