富文本添加图片设置上传

This commit is contained in:
zh
2025-08-22 10:14:12 +08:00
parent 71988d8833
commit 0f518ef6cb

View File

@ -56,8 +56,8 @@ class richText {
MENU_CONF: { MENU_CONF: {
uploadImage: { uploadImage: {
fieldName: 'file', fieldName: 'file',
maxFileSize: 50 * 1024 * 1024, // maxFileSize: 50 * 1024 * 1024,
base64LimitSize: 50 * 1024 * 1024, // 50M 以下插入 base64 // base64LimitSize: 50 * 1024 * 1024, // 50M 以下插入 base64
server: this.uploadImageServer, server: this.uploadImageServer,
// // 上传之前触发 // // 上传之前触发
// onBeforeUpload(file) { // TS 语法 // onBeforeUpload(file) { // TS 语法
@ -95,18 +95,18 @@ class richText {
// console.log(`${file.name} 上传出错`, err, res) // console.log(`${file.name} 上传出错`, err, res)
// }, // },
// // 自定义上传 // 自定义上传
// async customUpload(file, insertFn) { // TS 语法 async customUpload(file, insertFn) { // TS 语法
// // async customUpload(file, insertFn) { // JS 语法 // async customUpload(file, insertFn) { // JS 语法
// // file 即选中的文件 // file 即选中的文件
// // 自己实现上传,并得到图片 url alt href // 自己实现上传,并得到图片 url alt href
// // 最后插入图片 // 最后插入图片
// console.log(file, insertFn) let url = await _this.upload(file)
// insertFn(url, file.name) insertFn((_this.host = _this.host || getHost()) + '/' + url)
// } }
}, },
uploadVideo: { uploadVideo: {
maxFileSize: 500 * 1024 * 1024, // maxFileSize: 500 * 1024 * 1024,
server: this.uploadVideoServer, server: this.uploadVideoServer,
allowedFileTypes: ['video/mp4', 'video/mp3', 'video/ogg', 'video/webm', 'video/avi'], allowedFileTypes: ['video/mp4', 'video/mp3', 'video/ogg', 'video/webm', 'video/avi'],
// 自定义上传 // 自定义上传