From ca360e7564ea9f2eea26965eb398f0264cb381d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Fri, 23 Aug 2024 17:53:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model-rich-text-content.vue | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/components/model-rich-text/model-rich-text-content.vue b/src/components/model-rich-text/model-rich-text-content.vue index 1c114f48..b708d761 100644 --- a/src/components/model-rich-text/model-rich-text-content.vue +++ b/src/components/model-rich-text/model-rich-text-content.vue @@ -46,6 +46,7 @@ const editor_config = ref({ uploadImage: { // 自定义选择图片 customBrowseAndUpload(insertFn: InsertFnType) { + upload_insert.value = insertFn; rich_upload_type.value = 'img'; visibleDialog.value = true; cursor_position.value = editor_ref.value.selection; @@ -54,6 +55,7 @@ const editor_config = ref({ uploadVideo: { // 自定义上传视频 customBrowseAndUpload(insertFn: InsertFnType) { + upload_insert.value = insertFn; rich_upload_type.value = 'video'; visibleDialog.value = true; cursor_position.value = editor_ref.value.selection; @@ -61,6 +63,8 @@ const editor_config = ref({ }, }, }); +// 获取到对应的触发事件 +const upload_insert = ref(null); const handle_created = (editor: any) => { editor_ref.value = editor; // 记录 editor 实例,重要! }; @@ -76,20 +80,23 @@ const upload_list_change = (arry: uploadList[]) => { arry.forEach((item: uploadList) => { const url = item.url; const alt = item.title; - if (rich_upload_type.value === 'img') { - new_html += `${alt}`; - } else if (rich_upload_type.value === 'video') { - new_html += `