From e2a02d5cc467f1e7fe3127b08c10f3bdb134f002 Mon Sep 17 00:00:00 2001 From: jscyl13849007907 <13849007907@163.com> Date: Sat, 30 Aug 2025 10:31:34 +0800 Subject: [PATCH] no message --- root/components/chatEvent/message.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/root/components/chatEvent/message.vue b/root/components/chatEvent/message.vue index 503922a..4f155be 100644 --- a/root/components/chatEvent/message.vue +++ b/root/components/chatEvent/message.vue @@ -31,7 +31,7 @@ cusMessage: { handler(newVal) { console.log('newVal',newVal) - const hasDot = newVal.endsWith('。'); + const hasDot = String(newVal).endsWith('。'); const messageWithoutDot = hasDot ? newVal.slice(0, -1) : newVal; this.displayedMessage = messageWithoutDot; if (this.isShow) { @@ -45,9 +45,12 @@ 'isRender': { handler(newVal) { this.isShow = newVal; - const hasDot = this.cusMessage.endsWith('。'); - const messageWithoutDot = hasDot ? this.cusMessage.slice(0, -1) : this.cusMessage; - this.displayedMessage = this.isShow ? messageWithoutDot + '...' : (hasDot ? messageWithoutDot + '。' : messageWithoutDot); + if(this.cusMessage){ + let _str = String(this.cusMessage); + const hasDot = _str.endsWith('。'); + const messageWithoutDot = hasDot ? _str.slice(0, -1) : _str; + this.displayedMessage = this.isShow ? messageWithoutDot + '...' : (hasDot ? messageWithoutDot + '。' : messageWithoutDot); + } }, immediate: true }