From 31b03beb2c2c597902993f9f9760e7019c651167 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sat, 5 Aug 2023 17:54:49 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=A1=A8=E6=83=85?= =?UTF-8?q?=E5=85=B3=E9=94=AE=E8=AF=8D=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/components/ChatInput/index.vue | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/resources/assets/js/pages/manage/components/ChatInput/index.vue b/resources/assets/js/pages/manage/components/ChatInput/index.vue index 68d10996f..030c44b0b 100755 --- a/resources/assets/js/pages/manage/components/ChatInput/index.vue +++ b/resources/assets/js/pages/manage/components/ChatInput/index.vue @@ -871,18 +871,29 @@ export default { } this.emojiTimer && clearTimeout(this.emojiTimer) this.emojiTimer = setTimeout(_ => { - text = text.replace(/ /g," ") - text = text.replace(/<[^>]+>/g, "") + if (/]+>/g, "") if (text && text.indexOf(" ") === -1 && text.length >= 1 - && text.length <= 4 + && text.length <= 8 && $A.isArray(window.emoticonData)) { // 显示快捷选择表情窗口 this.emojiQuickItems = []; - let baseUrl = $A.apiUrl("../images/emoticon") + const baseUrl = $A.apiUrl("../images/emoticon") window.emoticonData.some(data => { - let item = data.list.find(d => $A.strExists(d.name + (d.key ? ` ${d.key}` : ''), text)) + const item = data.list.find(d => { + const ks = [d.name] + if (d.key) { + ks.push(...(`${d.key}`).split(" ")) + } + return ks.includes(text) + }) if (item) { this.emojiQuickItems.push(Object.assign(item, { type: `emoticon`,