From 986d075dbb73667f5d4de219ae20edcc0c10c6dc Mon Sep 17 00:00:00 2001 From: liaoxinyu Date: Thu, 13 Mar 2025 09:11:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9k=E7=BA=BF=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/contract/handicap.vue | 2 ++ src/views/contract/index.vue | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/views/contract/handicap.vue b/src/views/contract/handicap.vue index 3302791..3f2e563 100644 --- a/src/views/contract/handicap.vue +++ b/src/views/contract/handicap.vue @@ -198,6 +198,7 @@ export default { bus.$on('collapse', msg => { this.newPriceObj.price =this.symbol=='BTC'? (msg.close).toFixed(1):(msg.close).toFixed(3); this.$emit("input", this.newPriceObj); + localStorage.setItem("price",this.newPriceObj.price) }); }, // 获取盘口 @@ -214,6 +215,7 @@ export default { this.tradeList = res.swapTradeList; this.newPriceObj = this.tradeList[0]; this.$emit("input", this.newPriceObj); + localStorage.setItem("price",this.newPriceObj.price) }); }, // 计算深度 diff --git a/src/views/contract/index.vue b/src/views/contract/index.vue index d644077..d15c6a2 100644 --- a/src/views/contract/index.vue +++ b/src/views/contract/index.vue @@ -20,7 +20,8 @@ decreace2: activeContract.increase < 0, increase: activeContract.increase >= 0 }"> - {{ activeContract.price }} + + {{price1}} - {{ item.price }} + + {{item.symbol == activeSymbol ? price1 : item.price}}
{{ item.increaseStr }} @@ -244,7 +246,9 @@ export default { symbolDetail:{}, currentIcon: '', filterCoin: "", - contractListFilter: [] + contractListFilter: [], + price1:0, + intervalId:'' }; }, computed: { @@ -314,8 +318,7 @@ export default { if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price }) }); - - + this.startWatchingPrice(); }, //三秒更新一次数据 mounted: function () { @@ -324,6 +327,12 @@ export default { }, 2000) }, methods: { + startWatchingPrice(){ + this.intervalId = setInterval(() => { + let newPrice = localStorage.getItem('price'); + this.price1 = newPrice; + }, 10); // 每秒检查一次 + }, ispopover1(item){ this.activeSymbol=item; // this.$refs.popover.showPopper = false;