From 60b40209da2d7b69e9b26ab5d63f72b9935fa15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Wed, 10 Dec 2025 11:12:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=9A=E5=8A=A1=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/live-content/live-content.vue | 25 +++++++++------ pages/plugins/live/pull/pull.nvue | 22 +++++++------ pages/plugins/live/pull/pull.vue | 32 ++++++++++--------- 3 files changed, 45 insertions(+), 34 deletions(-) diff --git a/pages/plugins/live/pull/components/live-content/live-content.vue b/pages/plugins/live/pull/components/live-content/live-content.vue index d431adbc..bc90b67c 100644 --- a/pages/plugins/live/pull/components/live-content/live-content.vue +++ b/pages/plugins/live/pull/components/live-content/live-content.vue @@ -324,6 +324,8 @@ * 组件挂载后执行初始化操作 */ mounted() { + console.log('1111'); + // 初始化窗口信息和滚动条高度 this.init_window_info(); // 滚动到评论区底部 @@ -337,6 +339,8 @@ * 组件销毁前清理资源 */ beforeDestroy() { + console.log('222'); + // 清理socket连接 this.clear_interval_task(); this.unbind_keyboard_listener(); @@ -592,7 +596,7 @@ user_name: data.content, text: '', }); - } + } // 添加内容之后,需要滚动到最后 this.scroll_to_lower(); break; @@ -603,15 +607,18 @@ if (this.bulletins.length > 0 && this.bulletins[this.bulletins.length - 1].type == 'go') { this.bulletins.splice(this.bulletins.length - 1, 1); } - this.bulletins.push({ - id: Math.random(), - type: 'user', - user_avatar: data.data.user.avatar, - user_name: data.data.user.nickname, - text: data.content, + this.$nextTick(() => { + this.bulletins.push({ + id: Math.random(), + type: 'user', + user_avatar: data.data.user.avatar, + user_name: data.data.user.nickname, + text: data.content, + }); + console.log(this.bulletins); + // 添加内容之后,需要滚动到最后 + this.scroll_to_lower(); }); - // 添加内容之后,需要滚动到最后 - this.scroll_to_lower(); break; case 'live-status': console.log(data.content, 'live-status'); diff --git a/pages/plugins/live/pull/pull.nvue b/pages/plugins/live/pull/pull.nvue index c4c5e9d2..914584a1 100644 --- a/pages/plugins/live/pull/pull.nvue +++ b/pages/plugins/live/pull/pull.nvue @@ -6,17 +6,19 @@ - - - - - - {{live_end_msg}} - +