bugfix: 切换对话时初始化对话框
This commit is contained in:
@@ -124,6 +124,7 @@
|
|||||||
projectStore.clearProject()
|
projectStore.clearProject()
|
||||||
if (newVal) {
|
if (newVal) {
|
||||||
handleGetProjectInfoAndHistory()
|
handleGetProjectInfoAndHistory()
|
||||||
|
MyEvent.emit('projectChange')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -494,12 +494,12 @@
|
|||||||
editorRef.value?.addEventListener('input', removePlaceholderOnInput)
|
editorRef.value?.addEventListener('input', removePlaceholderOnInput)
|
||||||
}
|
}
|
||||||
|
|
||||||
const toogltReportTag = () => {
|
const toogltReportTag = (clear = false) => {
|
||||||
stopTypewriter() // 移除标签时停止打字机效果
|
stopTypewriter() // 移除标签时停止打字机效果
|
||||||
// 清理掉已被删除的标签引用(从 DOM 中移除的元素)
|
// 清理掉已被删除的标签引用(从 DOM 中移除的元素)
|
||||||
reportTags.value = reportTags.value.filter((tag) => tag.parentNode !== null)
|
reportTags.value = reportTags.value.filter((tag) => tag.parentNode !== null)
|
||||||
|
|
||||||
if (reportTags.value.length > 0) {
|
if (reportTags.value.length > 0 ) {
|
||||||
// 移除所有标签及其关联的零宽空格
|
// 移除所有标签及其关联的零宽空格
|
||||||
reportTags.value.forEach((tag) => {
|
reportTags.value.forEach((tag) => {
|
||||||
if (
|
if (
|
||||||
@@ -722,14 +722,6 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 初始化编辑器高度
|
|
||||||
onMounted(() => {
|
|
||||||
MyEvent.add('quote', handleQuote)
|
|
||||||
nextTick(() => {
|
|
||||||
autoResizeEditor()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
const typeValue = ref<string>('')
|
const typeValue = ref<string>('')
|
||||||
const areaValue = ref<string>('')
|
const areaValue = ref<string>('')
|
||||||
const styleValue = ref<string>('')
|
const styleValue = ref<string>('')
|
||||||
@@ -826,8 +818,27 @@
|
|||||||
if (hasQuoted) return
|
if (hasQuoted) return
|
||||||
quoteList.value[0] = url
|
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(() => {
|
onUnmounted(() => {
|
||||||
MyEvent.remove('quote', handleQuote)
|
MyEvent.remove('quote', handleQuote)
|
||||||
|
MyEvent.remove('projectChange', handleInitInput)
|
||||||
})
|
})
|
||||||
// 暴露方法给父组件
|
// 暴露方法给父组件
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|||||||
Reference in New Issue
Block a user