diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue index 010839226f0de2d6cb9677dfa6fb03ed3c315f1f..22354768e50862f5584d2d3b811572b99dd298ed 100644 --- a/src/components/Editor/index.vue +++ b/src/components/Editor/index.vue @@ -124,7 +124,7 @@ watch(() => props.modelValue, val => { if (val !== currentValue) { currentValue = val === null ? "" : val; if (DataQuill) { - DataQuill.setContents(currentValue); + DataQuill.clipboard.dangerouslyPasteHTML(currentValue || ''); } } }, { immediate: true }) @@ -151,7 +151,7 @@ function init() { } console.log(DataQuill); - DataQuill.setContents(currentValue); + DataQuill.clipboard.dangerouslyPasteHTML(currentValue || ''); DataQuill.on("text-change", (delta, oldDelta, source) => { const html = editor.value.children[0].innerHTML; const text = DataQuill.getText(); @@ -304,4 +304,4 @@ function handleUploadError() { .ql-snow .ql-picker.ql-font .ql-picker-item[data-value="monospace"]::before { content: "等宽字体"; } - \ No newline at end of file +