feat: 上传emit

This commit is contained in:
dap
2025-03-30 13:55:02 +08:00
parent f16afe657e
commit 6c4d15136f
4 changed files with 31 additions and 7 deletions

View File

@@ -8,7 +8,7 @@ import type {
UploadListType,
} from 'ant-design-vue/es/upload/interface';
import type { BaseUploadProps } from './props';
import type { BaseUploadProps, UploadEmits } from './props';
import { $t, I18nT } from '@vben/locales';
@@ -45,6 +45,8 @@ const props = withDefaults(defineProps<ImageUploadProps>(), {
abortOnUnmounted: true,
});
const emit = defineEmits<UploadEmits>();
// 双向绑定 ossId
const ossIdList = defineModel<string | string[]>('value', {
default: () => [],
@@ -57,7 +59,7 @@ const {
beforeUpload,
innerFileList,
customRequest,
} = useUpload(props, ossIdList);
} = useUpload(props, emit, ossIdList);
const { previewVisible, previewImage, handleCancel, handlePreview } =
useImagePreview();