this.editor = new E(`#editor`);
let client = new OSS({
region: "oss-cn-beijing",
secure: true,
accessKeyId: "LTAI5tJ6HS33XA1oioztTfYy",
accessKeySecret: "I0KokTB1DN0ZxkcjTGimSscVAvTZ41",
bucket: "judian-oss",
});
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
this.editor.config.customUploadImg = async function (
resultFiles,
insertImgFn
) {
// resultFiles 是 input 中选中的文件列表
// insertImgFn 是获取图片 url 后,插入到编辑器的方法
for (let index = 0; index < resultFiles.length; index++) {
var filename =
year + "/" + month + "/" + day + "/" + Math.random().toString(36);
let res = await client.put(filename, resultFiles[index]);
insertImgFn(res.url);
}
};
可以多选上传,并且是按照图片的顺序进行上传