Browse Source

优化WS

master
ltlzx 4 years ago
parent
commit
80190076e3
  1. 11
      src/views/contract/handicap.vue
  2. 10
      src/views/contract/index.vue

11
src/views/contract/handicap.vue

@ -162,11 +162,11 @@ export default {
}, },
computed: { computed: {
msg() { msg() {
return { return {
buy: `swapBuyList_${this.symbol}`, buy: `swapBuyList_${this.symbol}`,
sell: `swapSellList_${this.symbol}`, sell: `swapSellList_${this.symbol}`,
trade: `swapTradeList_${this.symbol}` trade: `swapTradeList_${this.symbol}`
}; };
}, },
sellListShow() { sellListShow() {
let list = this.sellList.splice(0, 12); let list = this.sellList.splice(0, 12);
@ -267,6 +267,7 @@ export default {
}); });
} }
}); });
}, },
// //
unLink(symbol) { unLink(symbol) {

10
src/views/contract/index.vue

@ -130,6 +130,7 @@
:wsUrl="wsUrl" :wsUrl="wsUrl"
:ws="ws" :ws="ws"
class="mr-2" class="mr-2"
ref="handicap"
/> />
<!-- 交易 --> <!-- 交易 -->
<exchange-store <exchange-store
@ -263,6 +264,7 @@ export default {
this.ws.on("open", () => { this.ws.on("open", () => {
this.swapMarketList(); this.swapMarketList();
}); });
console.info(this.$refs)
}, },
// //
mounted: function () { mounted: function () {
@ -296,9 +298,15 @@ export default {
this.ws.on('close',()=>{ this.ws.on('close',()=>{
this.ws= new Socket(this.Globals.Server.Path.WS1), this.ws= new Socket(this.Globals.Server.Path.WS1),
console.log('链接关闭'); console.log('链接关闭');
this.swapMarketList(); this.wsOpen();
}) })
}, },
wsOpen(){
this.ws.on("open", () => {
this.swapMarketList();
this.$refs.handicap.linkSocket()
});
},
// //
getMarketList() { getMarketList() {
Contract.getMarketList().then(res => { Contract.getMarketList().then(res => {

Loading…
Cancel
Save