You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/packages/uploader/doc.en-US.md
+49-47Lines changed: 49 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,59 +91,61 @@ import { Uploader } from '@nutui/nutui-react'
91
91
### Props
92
92
93
93
| Property | Description | Type | Default |
94
-
| --- | --- | --- | --- | autoUpload | Whether to upload the file immediately after selecting it.
95
-
| autoUpload | If or not the upload will be done immediately after the file is selected, if false, you need to manually execute the ref submit method to upload | `boolean` | `true` | upload | The upload method, the input parameter is the file to be uploaded.
96
-
| upload | Upload method, input is the file object to be uploaded, after asynchronous processing, return the upload result |`(file: File) => Promise<FileItem>`|`-`|
97
-
| name | The name of the `input` tag `name`, the name of the file parameter sent to the backend |`string`|`file`|
98
-
| defaultValue | Default list of files already uploaded |`FileItem[]`|`[]`|
99
-
| value | List of files that have been uploaded |`FileItem[]`|`-`|
100
-
| preview | Whether or not to show the preview image after a successful upload |`boolean`|`true`|
| fit | Picture fill mode |`contain`\|`cover`\|`fill`\|`none`\|`scale-down`|`cover`|
109
-
| clearInput | If or not you want to clear the `input` content, set it to `true` to support selecting the same file to upload over and over again |`boolean`|`true`|
110
-
| accept | Allowed file types to be uploaded, [Details] (https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/Input/file#%E9%99%90%E5%88%B6%E5%85%81%E8%AE%B8%E7%9A%84%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B)|`string`|`*`|
| deleteIcon | Delete the icon name of the region |`React.ReactNode`|`-`|
113
-
| uploadLabel | Text below the image in the upload area | `React.
114
-
| multiple | Whether to support file multi-selection |`boolean`|`false`|
115
-
| disabled | Whether to disable file uploading |`boolean`|`false`|
116
-
| beforeUpload | The beforeUpload function needs to return a`Promise`object |```(file: File[]) => Promise<File[] \| boolean>```|`-`|
117
-
| beforeDelete | Callback when deleting a file, does not remove it if the return value is false. Supports returning a`Promise`object, which is not removed when resolve(false) or reject |```(file: FileItem, files: FileItem[]) => boolean```|`-`|
| onOverCount | Triggered when the number of files exceeds the limit |`(count: number) => void`|`-`|
120
-
| onChange | Triggered when the list of uploaded files changes |```(files: FileItem[]) => void```|`-`|
121
-
| onDelete | Triggered when clicked to delete a file |```(file: FileItem, files: FileItem[]) => void```|`-`|
122
-
| onFileItemClick | Triggered when a file is uploaded successfully |```(file: FileItem, index: number) => void```|`-`|
123
-
| onUploadQueueChange | Triggered when the image upload queue changes |```(tasks: FileItem[]) => void```|`-`|
124
-
125
-
> Note: accept, capture and multiple are the native attributes of the browser input tag, the support for these attributes varies among mobile models, so there may be some compatibility issues under different models and WebViews.
94
+
| --- | --- | --- | --- |
95
+
| autoUpload | Whether to upload immediately after selecting the file, when false, you need to manually execute the ref submit method to upload |`boolean`|`true`|
96
+
| upload | Upload method, the input parameter is the file object to be uploaded, returns the upload result after asynchronous processing |`(file: File) => Promise<FileItem>`|`-`|
97
+
| name | The name of the `input` tag, the file parameter name sent to the backend |`string`|`file`|
98
+
| defaultValue | Default uploaded file list |`FileItem[]`|`[]`|
99
+
| value | Uploaded file list |`FileItem[]`|`-`|
100
+
| preview | Whether to display preview image after successful upload |`boolean`|`true`|
101
+
| previewUrl | Default image address when uploading non-image('image') format |`string`|`-`|
102
+
| deletable | Whether to display delete button |`boolean`|`true`|
| uploadIcon | Upload area <ahref="#/zh-CN/component/icon">icon name</a> |`React.ReactNode`|`-`|
112
+
| deleteIcon | Delete area icon name |`React.ReactNode`|`-`|
113
+
| uploadLabel | Text below the upload area image |`React.ReactNode`|`-`|
114
+
| listUploadRender | Custom upload area in list mode |`React.ReactNode`|`-`|
115
+
| multiple | Whether to support multiple file selection |`boolean`|`false`|
116
+
| disabled | Whether to disable file upload |`boolean`|`false`|
117
+
| beforeUpload | The function before upload needs to return a `Promise` object |`(file: File[]) => Promise<File[] \| boolean>`|`-`|
118
+
| beforeDelete | Callback when deleting files, no removal when return value is false. Supports returning a `Promise` object, no removal when `Promise` object resolve(false) or reject |`(file: FileItem, files: FileItem[]) => boolean`|`-`|
| onOverCount | Triggered when the number of files exceeds the limit |`(count: number) => void`|`-`|
121
+
| onChange | Triggered when the uploaded file list changes |`(files: FileItem[]) => void`|`-`|
122
+
| onDelete | Triggered when clicking to delete file |`(file: FileItem, files: FileItem[]) => void`|`-`|
123
+
| onFileItemClick | Triggered when clicking after file upload success |`(file: FileItem, index: number) => void`|`-`|
124
+
| onUploadQueueChange | Triggered when the image upload queue changes |`(tasks: FileItem[]) => void`|`-`|
125
+
126
+
> Note: accept, capture and multiple are native attributes of browser input tags. Mobile devices have different levels of support for these attributes, so compatibility issues may occur on different models and WebViews.
126
127
127
128
### FileItem
128
129
129
-
| Name | Description | Default Value |
130
-
| --- | --- | --- | status | File status value.
131
-
| status | File status value, optionally 'ready,uploading,success,error' |`ready`|
132
-
| uid | Unique identifier of the file | `-` | name | File name.
133
-
| name | File name | `-` | url | Path to file
134
-
| url | file path | `-` | uid | unique identifier for the file | `-` | name | file name | `-` | url | file path | `-` | type | file type
135
-
| type |file type |`image`|
136
-
| loadingIcon | Loading Icon|`-`|
137
-
| failIcon |failureIcon|`-`|
138
-
| percentage |upload prgress percent|`-`|
130
+
| Name | Description | Default |
131
+
| --- | --- | --- |
132
+
| status | File status value, optional 'ready,uploading,success,error' |`ready`|
133
+
| uid | Unique identifier of the file |`-`|
134
+
| name | File name |`-`|
135
+
| url |File path |`-`|
136
+
| type |File type |`image`|
137
+
| loadingIcon | Loading icon|`-`|
138
+
| failIcon |Failed loading icon|`-`|
139
+
| percentage |Upload progress bar percentage|`-`|
139
140
140
141
### Methods
141
142
142
-
The Uploader instance can be retrieved by ref and the instance methods called.
0 commit comments