|
@@ -263,9 +263,10 @@ const setInitSocket = () => {
|
|
|
console.log('websocket连接已断开')
|
|
|
};
|
|
|
socket.onmessage = function ({data}) {
|
|
|
- let msg = JSON.parse(data)
|
|
|
- msgCount.value = msg
|
|
|
- console.log(msg)
|
|
|
+ if (data) {
|
|
|
+ msgCount.value = JSON.parse(data)
|
|
|
+ }
|
|
|
+ console.log(data)
|
|
|
};
|
|
|
socket.onerror = function ({data}) {
|
|
|
console.log('发生错误:', data)
|