From 40c4b7f8ac6cbac852999c79ffce0af5d52d33ab Mon Sep 17 00:00:00 2001 From: zhangyahui Date: Fri, 27 Mar 2026 11:45:06 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=20=E5=88=87=E6=8D=A2=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D=E6=97=B6=E5=88=9D=E5=A7=8B=E5=8C=96=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/agent/index.vue | 1 + src/views/home/components/Input.vue | 31 +++++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/views/home/agent/index.vue b/src/views/home/agent/index.vue index f7eaa08..fb54be7 100644 --- a/src/views/home/agent/index.vue +++ b/src/views/home/agent/index.vue @@ -124,6 +124,7 @@ projectStore.clearProject() if (newVal) { handleGetProjectInfoAndHistory() + MyEvent.emit('projectChange') } } ) diff --git a/src/views/home/components/Input.vue b/src/views/home/components/Input.vue index 2992da0..1149da5 100644 --- a/src/views/home/components/Input.vue +++ b/src/views/home/components/Input.vue @@ -494,12 +494,12 @@ editorRef.value?.addEventListener('input', removePlaceholderOnInput) } - const toogltReportTag = () => { + const toogltReportTag = (clear = false) => { stopTypewriter() // 移除标签时停止打字机效果 // 清理掉已被删除的标签引用(从 DOM 中移除的元素) reportTags.value = reportTags.value.filter((tag) => tag.parentNode !== null) - if (reportTags.value.length > 0) { + if (reportTags.value.length > 0 ) { // 移除所有标签及其关联的零宽空格 reportTags.value.forEach((tag) => { if ( @@ -722,14 +722,6 @@ }) }) - // 初始化编辑器高度 - onMounted(() => { - MyEvent.add('quote', handleQuote) - nextTick(() => { - autoResizeEditor() - }) - }) - const typeValue = ref('') const areaValue = ref('') const styleValue = ref('') @@ -826,8 +818,27 @@ if (hasQuoted) return quoteList.value[0] = url } + + const handleInitInput = () => { + inputValue.value = '' + uploadedImages.value = [] + quoteList.value = [] + toogltReportTag(true) + if (editorRef.value) { + editorRef.value.innerHTML = '' + } + } + + onMounted(() => { + MyEvent.add('quote', handleQuote) + MyEvent.add('projectChange', handleInitInput) + nextTick(() => { + autoResizeEditor() + }) + }) onUnmounted(() => { MyEvent.remove('quote', handleQuote) + MyEvent.remove('projectChange', handleInitInput) }) // 暴露方法给父组件 defineExpose({