diff --git a/src/views/contract/index.vue b/src/views/contract/index.vue index 4a1c747..7e224e2 100644 --- a/src/views/contract/index.vue +++ b/src/views/contract/index.vue @@ -199,7 +199,9 @@ export default { symbolDetail:{}, currentIcon: '', imge:[], - Liste:[] + Liste:[], + price1:0, + intervalId:'' }; }, computed: { @@ -246,6 +248,7 @@ export default { if(item.symbol==this.activeContract.symbol) item.realtimePrice=this.activeContract.price }) }); + this.startWatchingPrice() }, //三秒更新一次数据 mounted: function () { @@ -255,6 +258,12 @@ export default { }, 2000) }, methods: { + startWatchingPrice(){ + this.intervalId = setInterval(() => { + let newPrice = localStorage.getItem('price'); + this.price1 = newPrice; + }, 10); // 每秒检查一次 + }, ispopover1(item){ this.activeSymbol=item; this.getMarketList();