extends Component
{
+ uploaderRef: UploaderRef;
+
+ abort(file: File) {
+ this.uploaderRef.abort(file);
+ }
+
+ startUpload() {
+ this.uploaderRef.startUpload();
+ }
+
+ saveUploaderRef = (ref: UploaderRef | { getInstance: () => UploaderRef } | null) => {
+ if (ref && typeof (ref as { getInstance: () => UploaderRef }).getInstance === 'function') {
+ this.uploaderRef = (ref as { getInstance: () => UploaderRef }).getInstance();
+ } else {
+ this.uploaderRef = ref as UploaderRef;
+ }
+ };
+
+ isUploading() {
+ return this.uploaderRef.isUploading();
+ }
+}
diff --git a/components/upload/card.jsx b/components/upload/card.tsx
similarity index 76%
rename from components/upload/card.jsx
rename to components/upload/card.tsx
index eadd86877f..30ca338d8f 100644
--- a/components/upload/card.jsx
+++ b/components/upload/card.tsx
@@ -8,12 +8,13 @@ import { func, obj } from '../util';
import Base from './base';
import List from './list';
import Upload from './upload';
+import type { CardProps, CardState, ObjectFile, UploadFile } from './types';
/**
* Upload.Card
- * @description 继承 Upload 的 API,除非特别说明
+ * 继承 Upload 的 API,除非特别说明
*/
-class Card extends Base {
+class Card extends Base
{locale.drag.text} {locale.drag.hint} {locale!.drag!.text} {locale!.drag!.hint}