From 78305075a59cafd1d69acdfeac2a856b4d3ce0c2 Mon Sep 17 00:00:00 2001 From: taohebin Date: Wed, 27 Dec 2023 18:07:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../websocket-global/websocket-global.uvue | 24 ++++++++++--------- pages/template/list-news/detail/detail.uvue | 8 +++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pages/API/websocket-global/websocket-global.uvue b/pages/API/websocket-global/websocket-global.uvue index 06d2087f..6e1f56f8 100644 --- a/pages/API/websocket-global/websocket-global.uvue +++ b/pages/API/websocket-global/websocket-global.uvue @@ -72,16 +72,18 @@ uni.showLoading({ title: '连接中...', }) - uni.connectSocket({ - url: 'ws://websocket.dcloud.net.cn', - success: (res : any) => { - // 这里是接口调用成功的回调,不是连接成功的回调,请注意 - console.log('uni.connectSocket success', res) - }, - fail: (err : any) => { - // 这里是接口调用失败的回调,不是连接失败的回调,请注意 - console.log('uni.connectSocket fail', err) - }, + uni.connectSocket({ + url: 'ws://websocket.dcloud.net.cn', + header: null, + protocols: null, + success: (res: any) => { + // 这里是接口调用成功的回调,不是连接成功的回调,请注意 + console.log('uni.connectSocket success', res) + }, + fail: (err: any) => { + // 这里是接口调用失败的回调,不是连接失败的回调,请注意 + console.log('uni.connectSocket fail', err) + }, }) uni.onSocketOpen((res) => { this.connecting = false @@ -170,4 +172,4 @@ line-height: 24px; color: #666666; } - \ No newline at end of file + diff --git a/pages/template/list-news/detail/detail.uvue b/pages/template/list-news/detail/detail.uvue index 901c4b8c..1a7fb542 100644 --- a/pages/template/list-news/detail/detail.uvue +++ b/pages/template/list-news/detail/detail.uvue @@ -23,11 +23,9 @@ } }, onLoad(event: OnLoadOptions) { - if (event != null) { - this.post_id = event["post_id"] ?? ""; - this.cover = event["cover"] ?? ""; - this.title = event["title"] ?? ""; - } + this.post_id = event["post_id"] ?? ""; + this.cover = event["cover"] ?? ""; + this.title = event["title"] ?? ""; this.getDetail(); }, methods: { -- GitLab