| 1234567891011121314151617181920 |
- import CommonContent from "@/api/CommonContent";
- import type { UploaderAction } from "@/components/form/Uploader";
- export function useImageSimpleUploadCo(additionData?: Record<string, any>) {
- return (action: UploaderAction) => {
- action.onStart('正在上传');
- CommonContent.uploadFile(action.item.filePath, 'image', 'file', additionData)
- .then((res) => {
- action.onProgress(100);
- action.onFinish({
- uploadedUrl: res.fullurl,
- previewUrl: res.fullurl,
- }, '上传成功');
- }).catch((err) => {
- action.onError?.(err);
- })
- }
- }
|