diff --git a/App.vue b/App.vue index e659b63..b86da0c 100644 --- a/App.vue +++ b/App.vue @@ -1,98 +1,33 @@ diff --git a/pages/demo/index.vue b/pages/demo/index.vue index 23ea720..16a2dae 100644 --- a/pages/demo/index.vue +++ b/pages/demo/index.vue @@ -284,6 +284,14 @@ export default { onUnload() { // 页面卸载时断开连接 if (this.client && this.isConnected) { + console.info("mqtt链接已关闭") + this.client.end() + } + }, + onHide() { + // 页面卸载时断开连接 + if (this.client && this.isConnected) { + console.info("mqtt链接已关闭") this.client.end() } },