fix: 🐛 修复因接口调整而影响的调用页面的问题
This commit is contained in:
@@ -78,7 +78,7 @@ watch(
|
||||
*/
|
||||
async function handleUpload(options: UploadRequestOptions): Promise<any> {
|
||||
// 上传API调用
|
||||
const { data: fileInfo } = await FileAPI.upload(options.file);
|
||||
const data = await FileAPI.upload(options.file);
|
||||
|
||||
// 上传成功需手动替换文件路径为远程URL,否则图片地址为预览地址 blob:http://
|
||||
const fileIndex = fileList.value.findIndex(
|
||||
@@ -86,8 +86,8 @@ async function handleUpload(options: UploadRequestOptions): Promise<any> {
|
||||
);
|
||||
|
||||
fileList.value.splice(fileIndex, 1, {
|
||||
name: fileInfo.name,
|
||||
url: fileInfo.url,
|
||||
name: data.name,
|
||||
url: data.url,
|
||||
} as UploadUserFile);
|
||||
|
||||
emit(
|
||||
|
||||
@@ -33,8 +33,8 @@ const imgUrl = useVModel(props, "modelValue", emit);
|
||||
* @param options
|
||||
*/
|
||||
async function uploadFile(options: UploadRequestOptions): Promise<any> {
|
||||
const { data: fileInfo } = await FileAPI.update(options.file);
|
||||
imgUrl.value = fileInfo.url;
|
||||
const data = await FileAPI.upload(options.file);
|
||||
imgUrl.value = data.url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
|
||||
|
||||
// API 引用
|
||||
import { uploadFileApi } from "@/api/file";
|
||||
import FileAPI from "@/api/file";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
@@ -46,9 +46,8 @@ const editorConfig = ref({
|
||||
uploadImage: {
|
||||
// 自定义图片上传
|
||||
async customUpload(file: any, insertFn: any) {
|
||||
uploadFileApi(file).then((response) => {
|
||||
const url = response.data.url;
|
||||
insertFn(url);
|
||||
FileAPI.upload(file).then((data) => {
|
||||
insertFn(data.url);
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user