From d941f5ad93c7f99131668fd73ad282519f19ccd1 Mon Sep 17 00:00:00 2001 From: astar <2320390964@qq.com> Date: Sat, 17 Apr 2021 15:06:48 +0800 Subject: [PATCH] fix: bug --- src/utils/editor.js | 14 ++++++++------ src/views/chat/components/inputBox.vue | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/utils/editor.js b/src/utils/editor.js index ce12d48..25f0011 100644 --- a/src/utils/editor.js +++ b/src/utils/editor.js @@ -2,7 +2,7 @@ * @Author: astar * @Date: 2021-04-01 16:02:08 * @LastEditors: astar - * @LastEditTime: 2021-04-17 13:34:43 + * @LastEditTime: 2021-04-17 14:07:22 * @Description: 文件描述 * @FilePath: \vue-chat\src\utils\editor.js */ @@ -89,11 +89,13 @@ export function getJSONFromInput ($ele) { value: child.textContent // 还需转义,到时候再说吧 }) } else if (nodeType === 1) { // 元素节点, 目前只有emoji和at类型,后期考虑其他 - let options = child.dataset - result.push({ - kind: options.kind, - value: options.value - }) + let options = child.dataset; + if (options.kind && options.value) { + result.push({ + kind: options.kind, + value: options.value + }); + } } }) return result diff --git a/src/views/chat/components/inputBox.vue b/src/views/chat/components/inputBox.vue index f0187dc..386af86 100644 --- a/src/views/chat/components/inputBox.vue +++ b/src/views/chat/components/inputBox.vue @@ -2,7 +2,7 @@ * @Author: astar * @Date: 2021-01-30 15:21:05 * @LastEditors: astar - * @LastEditTime: 2021-04-17 13:40:26 + * @LastEditTime: 2021-04-17 14:02:23 * @Description: 聊天输入框 * @FilePath: \vue-chat\src\views\chat\components\inputBox.vue --> @@ -23,7 +23,7 @@ - + @@ -133,6 +133,7 @@ export default { this.$emit('send', getJSONFromInput(this.$refs.input)); this.$refs.input.innerHTML = null; this.showEmojis = false; + this.showGifs = false; }, /** * 保存输入框光标最后所在位置,存入insertAtCursor函数