From 83becbbc36ce2aeecf18d4bc9d3ad7db0fcbbd7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Thu, 14 May 2026 13:59:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/live-content/live-content.vue | 26 +++++++------- pages/plugins/live/detail/mixins/mixins.js | 35 ++++++++++--------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/pages/plugins/live/detail/components/live-content/live-content.vue b/pages/plugins/live/detail/components/live-content/live-content.vue index 3f11654a..6769d99e 100644 --- a/pages/plugins/live/detail/components/live-content/live-content.vue +++ b/pages/plugins/live/detail/components/live-content/live-content.vue @@ -411,19 +411,19 @@ deep: true }, }, - /** - * 组件挂载后执行初始化操作 - */ - onShow() { - // 初始化窗口信息和滚动条高度 - this.init_window_info(); - // 滚动到评论区底部 - this.scroll_to_lower(); - // 获取用户信息 - // this.init_user_info(); - // 创建监听事件 - this.bind_keyboard_listener(); - }, + // /** + // * 组件挂载后执行初始化操作 + // */ + // onShow() { + // // 初始化窗口信息和滚动条高度 + // this.init_window_info(); + // // 滚动到评论区底部 + // this.scroll_to_lower(); + // // 获取用户信息 + // // this.init_user_info(); + // // 创建监听事件 + // this.bind_keyboard_listener(); + // }, /** * 组件销毁前清理资源 */ diff --git a/pages/plugins/live/detail/mixins/mixins.js b/pages/plugins/live/detail/mixins/mixins.js index b151c166..7ab9d91e 100644 --- a/pages/plugins/live/detail/mixins/mixins.js +++ b/pages/plugins/live/detail/mixins/mixins.js @@ -158,25 +158,26 @@ export default { // 隐藏加载提示 uni.hideLoading(); } - //#ifndef H5 - // 确保每次重新显示都触发组件中的初始化方法 - this.liveContentTimer = setInterval(() => { - if (this.$refs.liveContent) { - const content = this.$refs.liveContent; + + // 确保每次重新显示都触发组件中的初始化方法 + this.liveContentTimer = setInterval(() => { + if (this.$refs.liveContent) { + const content = this.$refs.liveContent; + //#ifndef H5 // 链接socket content.socket_connect(); - // 初始化头部信息 - content.init_window_info(); - // 滚动到消息底部 - content.scroll_to_lower(); - // 绑定键盘事件 - content.bind_keyboard_listener(); - // 执行成功后取消定时任务 - clearInterval(this.liveContentTimer); - this.liveContentTimer = null; - } - }, 200); - //#endif + //#endif + // 初始化头部信息 + content.init_window_info(); + // 滚动到消息底部 + content.scroll_to_lower(); + // 绑定键盘事件 + content.bind_keyboard_listener(); + // 执行成功后取消定时任务 + clearInterval(this.liveContentTimer); + this.liveContentTimer = null; + } + }, 200); }, fail: (err) => { // 隐藏加载提示