21
This commit is contained in:
parent
02941ac222
commit
7f09049f6d
|
|
@ -22,7 +22,7 @@
|
|||
</el-form-item>
|
||||
|
||||
<el-form-item label="内容" prop="content">
|
||||
<div v-if="editorReady" class="editor-container">
|
||||
<div v-if="showEditor" class="editor-container">
|
||||
<Toolbar
|
||||
:editor="editorRef"
|
||||
:defaultConfig="toolbarConfig"
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
@onCreated="handleCreated"
|
||||
/>
|
||||
</div>
|
||||
<div v-else-if="dialogVisible" class="editor-loading">
|
||||
<div v-else class="editor-loading">
|
||||
<el-icon class="is-loading"><Loading /></el-icon>
|
||||
<span>加载编辑器中...</span>
|
||||
</div>
|
||||
|
|
@ -84,7 +84,7 @@ const dialogVisible = computed({
|
|||
|
||||
// 编辑器实例
|
||||
const editorRef = shallowRef<IDomEditor>()
|
||||
const editorReady = ref(false)
|
||||
const showEditor = ref(false)
|
||||
const mode = 'default'
|
||||
|
||||
// 工具栏配置
|
||||
|
|
@ -198,7 +198,6 @@ const handleCreated = (editor: IDomEditor) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
editorReady.value = true
|
||||
}, 100)
|
||||
})
|
||||
}
|
||||
|
|
@ -209,7 +208,10 @@ watch(() => props.modelValue, (visible) => {
|
|||
if (visible && props.danye) {
|
||||
formData.title = props.danye.title
|
||||
formData.content = props.danye.content || ''
|
||||
editorReady.value = false
|
||||
// 延迟显示编辑器,确保弹窗已渲染
|
||||
nextTick(() => {
|
||||
showEditor.value = true
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -217,7 +219,7 @@ watch(() => props.modelValue, (visible) => {
|
|||
watch(dialogVisible, (visible) => {
|
||||
console.log('[DanyeFormDialog] dialogVisible changed:', visible)
|
||||
if (!visible) {
|
||||
editorReady.value = false
|
||||
showEditor.value = false
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -233,7 +235,7 @@ onBeforeUnmount(() => {
|
|||
const resetForm = () => {
|
||||
formData.title = ''
|
||||
formData.content = ''
|
||||
editorReady.value = false
|
||||
showEditor.value = false
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +246,7 @@ const handleClose = () => {
|
|||
editorRef.value.destroy()
|
||||
editorRef.value = undefined
|
||||
}
|
||||
editorReady.value = false
|
||||
showEditor.value = false
|
||||
dialogVisible.value = false
|
||||
resetForm()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user