From ab01115daa8524101aa38787bc93c2df55cec72b Mon Sep 17 00:00:00 2001 From: WX0lxh <2062408239@qq.com> Date: Wed, 4 Mar 2026 15:44:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packageB/components/unieditor.vue | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/packageB/components/unieditor.vue b/packageB/components/unieditor.vue index 6bf6c42..a65349f 100644 --- a/packageB/components/unieditor.vue +++ b/packageB/components/unieditor.vue @@ -386,11 +386,13 @@ // 基础 import { ref, + inject, reactive, onMounted, computed, getCurrentInstance } from 'vue' + const { $api, navTo, throttle, config } = inject('globalFunction'); const props = defineProps({ content: { type: String, @@ -538,24 +540,23 @@ success: (res) => { // 本地路径 let localPath = res.tempFilePaths[0] + // 在此可以自定义图片上传 + // 在此可以自定义图片上传 + // 在此可以自定义图片上传 + $api.uploadFile(localPath, true).then((resData) => { + resData = JSON.parse(resData); + // 插入图片 + editorCtx.value.insertImage({ + src: resData.msg, + alt: '图像', + success: function() { + console.log('insert image success') + } + }) + }); - // 在此可以自定义图片上传 - // 在此可以自定义图片上传 - // 在此可以自定义图片上传 - // ... - let onlinePath = localPath - - // 插入图片 - editorCtx.value.insertImage({ - src: onlinePath, - alt: '图像', - success: function() { - console.log('insert image success') - } - }) } }) } - \ No newline at end of file