From de517e0968a3470b490ddd10ccb9ca8ae36cc241 Mon Sep 17 00:00:00 2001 From: luyisha Date: Wed, 9 Aug 2023 18:18:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E4=BA=BA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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() {