Przeglądaj źródła

docs(upload): Update upload docs (#110)

songjianet 4 lat temu
rodzic
commit
5e9ef0acc6

+ 5 - 5
content/input/upload/index-en-US.md

@@ -885,8 +885,8 @@ class ValidateDemo extends React.Component {
 }
 ```
 
-In the case of asynchronous verification, a Promise must be returned. Promise reslove means that the verification is passed, and reject means that the verification fails and the upload will not be triggered.
-Object can be passed in when reslove/reject (the structure is the same as beforeUploadResult)
+In the case of asynchronous verification, a Promise must be returned. Promise resolve means that the verification is passed, and reject means that the verification fails and the upload will not be triggered.
+Object can be passed in when resolve/reject (the structure is the same as beforeUploadResult)
 
 ```jsx live=true width=48%
 import React from 'react';
@@ -903,14 +903,14 @@ class AsyncBeforeUploadDemo extends React.Component {
 
     beforeUpload({ file, fileList }) {
         let result;
-        return new Promise((reslove, reject) => {
+        return new Promise((resolve, reject) => {
             if (this.count > 1) {
                 result = {
                     autoRemove: false,
                     shouldUpload: true,
                 };
                 this.count = this.count + 1;
-                reslove(result);
+                resolve(result);
             } else {
                 result = {
                     autoRemove: false,
@@ -1085,7 +1085,7 @@ import { IconUpload } from '@douyinfe/semi-icons';
 |onAcceptInvalid | Triggered when the received file does not conform to the accept specification (generally because the folder selects all types of files / drags and drops files that do not conform to the format) | (files: File[]) => void | | 1.24 .0 |
 |onChange | Called when the file status changes, including upload success, failure, upload, the callback input parameter is Object, including fileList, currentFile, etc.| ({fileList: Array<FileItem\>, currentFile?: FileItem}) = > void | | 1.0.0 |
 |onClear | Callback when click to clear | () => void | | 1.1.0 |
-|onDrop | Triggered when the dragged element is released on the drag area | (e, files: Array<File\>, filelist: Array<FileItem\>) => void | | 1.9.0 |
+|onDrop | Triggered when the dragged element is released on the drag area | (e, files: Array<File\>, fileList: Array<FileItem\>) => void | | 1.9.0 |
 |onError | Callback when uploading error| (error: Error, file: [File](https://developer.mozilla.org/zh-CN/docs/Web/API/File), fileList: Array<FileItem\> , xhr: XMLHttpRequest) => void | | |
 |onExceed | Callback when the total number of uploaded files exceeds `limit` | (fileList:Array<FileItem\>) => void | | |
 |onFileChange | Callback after file selection | (Array<File\>) => void | | |

+ 5 - 5
content/input/upload/index.md

@@ -874,8 +874,8 @@ class ValidateDemo extends React.Component {
 }
 ```
 
-异步校验时,需返回 Promise,Promise reslove 代表检验通过,reject 代表校验失败,不会触发上传。  
-reslove/reject 时可以传入 object(结构同上 beforeUploadResult)
+异步校验时,需返回 Promise,Promise resolve 代表检验通过,reject 代表校验失败,不会触发上传。  
+resolve/reject 时可以传入 object(结构同上 beforeUploadResult)
 
 ```jsx live=true width=48%
 import React from 'react';
@@ -892,14 +892,14 @@ class AsyncBeforeUploadDemo extends React.Component {
 
     beforeUpload({ file, fileList }) {
         let result;
-        return new Promise((reslove, reject) => {
+        return new Promise((resolve, reject) => {
             if (this.count > 1) {
                 result = {
                     autoRemove: false,
                     shouldUpload: true,
                 };
                 this.count = this.count + 1;
-                reslove(result);
+                resolve(result);
             } else {
                 result = {
                     autoRemove: false,
@@ -1074,7 +1074,7 @@ import { IconUpload } from '@douyinfe/semi-icons';
 |onAcceptInvalid | 当接收到的文件不符合accept规范时触发(一般是因为文件夹选择了全部类型文件/拖拽不符合格式的文件时触发) | (files: File[]) => void | | 1.24.0 |
 |onChange | 文件状态发生变化时调用,包括上传成功,失败,上传中,回调入参为 Object,包含 fileList、currentFile 等值 | ({fileList: Array<FileItem\>, currentFile?: FileItem}) => void |  | 1.0.0 |
 |onClear | 点击清空时的回调 | () => void |  | 1.1.0 |
-|onDrop | 当拖拽的元素在拖拽区上被释放时触发 | (e, files: Array<File\>, filelist: Array<FileItem\>) => void |  | 1.9.0 |
+|onDrop | 当拖拽的元素在拖拽区上被释放时触发 | (e, files: Array<File\>, fileList: Array<FileItem\>) => void |  | 1.9.0 |
 |onError | 上传错误时的回调 | (error: Error, file: [File](https://developer.mozilla.org/zh-CN/docs/Web/API/File), fileList: Array<FileItem\>, xhr: XMLHttpRequest) => void |  |  |
 |onExceed | 上传文件总数超出 `limit` 时的回调 | (fileList:Array<FileItem\>) => void |  |  |
 |onFileChange | 选中文件后的回调 | (Array<File\>) => void |  |  |