From 31da01bdd1e4fe8fb8eec41f401d73bcf6cc18b7 Mon Sep 17 00:00:00 2001 From: ahao <liuhaoai545@gmail.com> Date: 星期六, 06 一月 2024 17:27:01 +0800 Subject: [PATCH] fix https://gitee.com/dromara/RuoYi-Vue-Plus/issues/I8TMAI --- src/components/Editor/index.vue | 32 ++++++++++++++++---------------- 1 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue index 05b574f..fc30c85 100644 --- a/src/components/Editor/index.vue +++ b/src/components/Editor/index.vue @@ -2,7 +2,6 @@ <div> <el-upload v-if="type === 'url'" - ref="uploadRef" :action="upload.url" :before-upload="handleBeforeUpload" :on-success="handleUploadSuccess" @@ -12,17 +11,18 @@ :show-file-list="false" :headers="upload.headers" > + <i ref="uploadRef"></i> </el-upload> - <div class="editor"> - <quill-editor - ref="quillEditorRef" - v-model:content="content" - content-type="html" - :options="options" - :style="styles" - @text-change="(e: any) => $emit('update:modelValue', content)" - /> - </div> + </div> + <div class="editor"> + <quill-editor + ref="quillEditorRef" + v-model:content="content" + content-type="html" + :options="options" + :style="styles" + @text-change="(e: any) => $emit('update:modelValue', content)" + /> </div> </template> @@ -57,6 +57,7 @@ url: import.meta.env.VITE_APP_BASE_API + '/resource/oss/upload' }); const quillEditorRef = ref(); +const uploadRef = ref<HTMLDivElement>(); const options = ref<any>({ theme: 'snow', @@ -78,10 +79,10 @@ ['link', 'image', 'video'] // 閾炬帴銆佸浘鐗囥�佽棰� ], handlers: { - image: function (value: any) { + image: (value: boolean) => { if (value) { // 璋冪敤element鍥剧墖涓婁紶 - (document.querySelector('.editor-img-uploader>.el-upload') as HTMLDivElement)?.click(); + uploadRef.value.click(); } else { Quill.format('image', true); } @@ -107,7 +108,7 @@ const content = ref(''); watch( () => props.modelValue, - (v) => { + (v: string) => { if (v !== content.value) { content.value = v === undefined ? '<p></p>' : v; } @@ -129,7 +130,7 @@ quill.setSelection(length + 1); proxy?.$modal.closeLoading(); } else { - proxy?.$modal.loading(res.msg); + proxy?.$modal.msgError('鍥剧墖鎻掑叆澶辫触'); proxy?.$modal.closeLoading(); } }; @@ -157,7 +158,6 @@ // 鍥剧墖澶辫触鎷︽埅 const handleUploadError = (err: any) => { - console.error(err); proxy?.$modal.msgError('涓婁紶鏂囦欢澶辫触'); }; </script> -- Gitblit v1.9.3