diff --git a/src/App.vue b/src/App.vue index d29e47e..7a4be5e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -59,6 +59,24 @@ export default { const seconds = ('0' + this.date.getSeconds()).slice(-2); this.curtime = `${hours}:${minutes}:${seconds}` this.nowtime = `${year}.${month}.${day} ` + cweeks[wday]; + + // 获取实时数据 + let that = this; + let ws = new WebSocket(publicConfig.WS_URL_ZL); + ws.onopen = function() {}; + ws.onclose = function(event) { + console.log('WebSocket连接已关闭'); + }; + ws.onmessage = (e)=> { + var jstr = JSON.parse(e.data) + if(!jstr){ + return; + } + // 中间数据 + that.sumYear_num = jstr.allGroupNum.data.year.noRepeatInNum; + + }; + }, updated(){}, mounted() {