diff --git a/pages/API/websocket-global/websocket-global.uvue b/pages/API/websocket-global/websocket-global.uvue index 06d2087fd3e9e05a96f82d1845289c03f3d63a5c..6e1f56f8c486284a4d0fb13ea7c72c110c2e54a9 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 901c4b8cde967f9a7b643b7f5f5f27e9220c97a8..1a7fb542568e8ac07132643be776ead2e427abb6 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: {