MK编辑器,无法上传多个图片

pull/7333/head v3.7.0last_springboot3
JEECG 2024-09-24 22:47:44 +08:00
parent 7fecdf94e5
commit 48805484d4
1 changed files with 19 additions and 1 deletions

View File

@ -12,6 +12,7 @@
import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated';
import { getTenantId, getToken } from '/@/utils/auth';
import { getFileAccessHttpUrl } from '/@/utils/common/compUtils';
import { uploadFile } from '@/api/common/api';
type Lang = 'zh_CN' | 'en_US' | 'ja_JP' | 'ko_KR' | undefined;
@ -161,7 +162,7 @@
//update-begin-author:taoyan date:2022-5-24 for: VUEN-1090 markdown
upload: {
accept: 'image/*',
url: uploadUrl,
//url: uploadUrl,
fieldName: 'file',
extraData: { biz: 'markdown' },
setHeaders() {
@ -173,6 +174,23 @@
format(files, response) {
return formatResult(files, response);
},
//
async handler(files) {
const uploadSuccess = (res) => {
// {"success":true,"message":"markdown/aa_1653391146501.png","code":0,"result":null,"timestamp":1653391146501}'
if (res.success) {
vditorRef.value?.insertValue(`![${res.message}](${getFileAccessHttpUrl(res.message)})`);
}
};
for (const file of files) {
let params = {
file: file,
filename: file.name,
data: { biz: 'markdown' },
};
await uploadFile(params, uploadSuccess);
}
},
},
//update-end-author:taoyan date:2022-5-24 for: VUEN-1090 markdown
input: (v) => {