From 43099582f80f86497c8d8a416871510f1d2b9d1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=AD=E2=80=AD=E8=83=96=E5=B0=B1=E8=83=96=E5=91=97?= <545731507@qq.com> Date: Tue, 21 Jun 2022 02:14:59 +0000 Subject: [PATCH] =?UTF-8?q?update=20src/components/Editor/index.vue.=20?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BC=96=E8=BE=91=E5=99=A8wangeditor=204.7.1?= =?UTF-8?q?5=20=E8=87=B3=205.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Editor/index.vue | 201 +++++++++++++++++++++----------- 1 file changed, 131 insertions(+), 70 deletions(-) diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue index 6bab39d..d6649ef 100644 --- a/src/components/Editor/index.vue +++ b/src/components/Editor/index.vue @@ -1,74 +1,135 @@ - + // 跨域是否传递 cookie ,默认为 false + withCredentials: true, + // 超时时间,默认为 30 秒 + timeout: 15 * 1000, // 15 秒 + // 自定义插入视频 + customInsert(res, insertFn) { + ;-( + // 从 res 中找到 url alt href ,然后插图图片 + insertFn(res.data.url) + ) + }, + } + onBeforeUnmount(() => { + const editor = editorRef.value + if (editor == null) return + editor.destroy() + }) + const handleCreated = (editor) => { + editorRef.value = editor + } + const handleChange = (editor) => { + emit('update:modelValue', editor.getHtml()) + } + watch( + () => props.modelValue, + (value) => { + const editor = editorRef.value + if (value == undefined) { + editor.clear() + return + } + valueHtml.value = value; + }, + ) + return { + editorRef, + valueHtml, + mode: 'default', + toolbarConfig, + editorConfig, + handleCreated, + handleChange, + } + }, +} + \ No newline at end of file -- Gitee