Skip to content

Commit f49437f

Browse files
authored
fix: typo (#6218)
* fix: typo * docs<upload>: docs update
1 parent 058bc36 commit f49437f

File tree

4 files changed

+32
-32
lines changed

4 files changed

+32
-32
lines changed

components/affix/index.tsx

+14-14
Original file line numberDiff line numberDiff line change
@@ -110,30 +110,30 @@ const Affix = defineComponent({
110110
status: AffixStatus.None,
111111
} as AffixState;
112112
const targetRect = getTargetRect(targetNode);
113-
const placeholderReact = getTargetRect(placeholderNode.value as HTMLElement);
114-
const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop.value);
115-
const fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom.value);
113+
const placeholderRect = getTargetRect(placeholderNode.value as HTMLElement);
114+
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop.value);
115+
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom.value);
116116
if (fixedTop !== undefined) {
117117
newState.affixStyle = {
118118
position: 'fixed',
119119
top: fixedTop,
120-
width: placeholderReact.width + 'px',
121-
height: placeholderReact.height + 'px',
120+
width: placeholderRect.width + 'px',
121+
height: placeholderRect.height + 'px',
122122
};
123123
newState.placeholderStyle = {
124-
width: placeholderReact.width + 'px',
125-
height: placeholderReact.height + 'px',
124+
width: placeholderRect.width + 'px',
125+
height: placeholderRect.height + 'px',
126126
};
127127
} else if (fixedBottom !== undefined) {
128128
newState.affixStyle = {
129129
position: 'fixed',
130130
bottom: fixedBottom,
131-
width: placeholderReact.width + 'px',
132-
height: placeholderReact.height + 'px',
131+
width: placeholderRect.width + 'px',
132+
height: placeholderRect.height + 'px',
133133
};
134134
newState.placeholderStyle = {
135-
width: placeholderReact.width + 'px',
136-
height: placeholderReact.height + 'px',
135+
width: placeholderRect.width + 'px',
136+
height: placeholderRect.height + 'px',
137137
};
138138
}
139139

@@ -169,9 +169,9 @@ const Affix = defineComponent({
169169
const targetNode = target();
170170
if (targetNode && placeholderNode.value) {
171171
const targetRect = getTargetRect(targetNode);
172-
const placeholderReact = getTargetRect(placeholderNode.value as HTMLElement);
173-
const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop.value);
174-
const fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom.value);
172+
const placeholderRect = getTargetRect(placeholderNode.value as HTMLElement);
173+
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop.value);
174+
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom.value);
175175
if (
176176
(fixedTop !== undefined && affixStyle.top === fixedTop) ||
177177
(fixedBottom !== undefined && affixStyle.bottom === fixedBottom)

components/affix/utils.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ export function getTargetRect(target: BindElement): DOMRect {
1010
: ({ top: 0, bottom: window.innerHeight } as DOMRect);
1111
}
1212

13-
export function getFixedTop(placeholderReact: DOMRect, targetRect: DOMRect, offsetTop: number) {
14-
if (offsetTop !== undefined && targetRect.top > placeholderReact.top - offsetTop) {
13+
export function getFixedTop(placeholderRect: DOMRect, targetRect: DOMRect, offsetTop: number) {
14+
if (offsetTop !== undefined && targetRect.top > placeholderRect.top - offsetTop) {
1515
return `${offsetTop + targetRect.top}px`;
1616
}
1717
return undefined;
1818
}
1919

2020
export function getFixedBottom(
21-
placeholderReact: DOMRect,
21+
placeholderRect: DOMRect,
2222
targetRect: DOMRect,
2323
offsetBottom: number,
2424
) {
25-
if (offsetBottom !== undefined && targetRect.bottom < placeholderReact.bottom + offsetBottom) {
25+
if (offsetBottom !== undefined && targetRect.bottom < placeholderRect.bottom + offsetBottom) {
2626
const targetBottomOffset = window.innerHeight - targetRect.bottom;
2727
return `${offsetBottom + targetBottomOffset}px`;
2828
}

components/upload/index.en-US.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Uploading is the process of publishing information (web pages, text, pictures, v
2222
| accept | File types that can be accepted. See [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) | string | - | | |
2323
| action | Uploading URL | string\|(file) => `Promise` | - | | |
2424
| beforeUpload | Hook function which will be executed before uploading. Uploading will be stopped with `false` or a rejected Promise returned. | (file, fileList) => `boolean` \| `Promise` | - | |
25-
| customRequest | override for the default xhr behavior allowing for additional customization and ability to implement your own XMLHttpRequest | Function | - | | |
25+
| customRequest | override for the default xhr behavior allowing for additional customization and ability to implement your own XMLHttpRequest | function | - | | |
2626
| data | Uploading params or function which can return uploading params. | object\|function(file) | - | | |
2727
| directory | support upload whole directory ([caniuse](https://caniuse.com/#feat=input-file-directory)) | boolean | false | | |
2828
| directory | Support upload whole directory([caniuse](https://caniuse.com/#feat=input-file-directory)| boolean | false | 3.0 | |
@@ -32,7 +32,7 @@ Uploading is the process of publishing information (web pages, text, pictures, v
3232
| headers | Set request headers, valid above IE10. | object | - | | |
3333
| iconRender | Custom show icon | v-slot:iconRender="{file: UploadFile, listType?: UploadListType}" | - | 3.0 | |
3434
| isImageUrl | Customize if render &lt;img /> in thumbnail | (file: UploadFile) => boolean | - | 3.0 | |
35-
| itemRender | Custom item of uploadList | v-slot:itemRender="{originNode: ReactElement, file: UploadFile, fileList: object\[], actions: { download: function, preview: function, remove: function }" | - | 3.0 | |
35+
| itemRender | Custom item of uploadList | v-slot:itemRender="{originNode: VNode, file: UploadFile, fileList: object\[], actions: { download: function, preview: function, remove: function }" | - | 3.0 | |
3636
| listType | Built-in stylesheets, support for three types: `text`, `picture` or `picture-card` | string | `text` | | |
3737
| maxCount | Limit the number of uploaded files. Will replace current one when `maxCount` is `1` | number | - | 3.0 | |
3838
| method | http method of upload request | string | `post` | 1.5.0 | |
@@ -43,19 +43,19 @@ Uploading is the process of publishing information (web pages, text, pictures, v
4343
| previewIcon | custom preview icon | v-slot:iconRender="{file: UploadFile}" | - | 3.0 | |
4444
| progress | Custom progress bar | [ProgressProps](/components/progress/#API) (support `type="line"` only) | { strokeWidth: 2, showInfo: false } | 3.0 | |
4545
| removeIcon | custom remove icon | v-slot:iconRender="{file: UploadFile}" | - | 3.0 | |
46-
| showUploadList | Whether to show default upload list, could be an object to specify `showPreviewIcon`, `showRemoveIcon` and `showDownloadIcon` individually | Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean, showDownloadIcon?: boolean } | true | showDownloadIcon(3.0) | |
46+
| showUploadList | Whether to show default upload list, could be an object to specify `showPreviewIcon`, `showRemoveIcon` and `showDownloadIcon` individually | boolean \| { showPreviewIcon?: boolean, showRemoveIcon?: boolean, showDownloadIcon?: boolean } | true | showDownloadIcon(3.0) | |
4747
| supportServerRender | Need to be turned on while the server side is rendering. | boolean | false | | |
4848
| withCredentials | ajax upload with cookie sent | boolean | false | | |
4949

5050
### events
5151

5252
| Events Name | Description | Arguments | Version | |
5353
| --- | --- | --- | --- | --- |
54-
| change | A callback function, can be executed when uploading state is changing. See [change](#change) | Function | - | |
55-
| download | Click the method to download the file, pass the method to perform the method logic, do not pass the default jump to the new TAB. | Function(file): void | Jump to new TAB | 1.5.0 |
54+
| change | A callback function, can be executed when uploading state is changing. See [change](#change) | function | - | |
55+
| download | Click the method to download the file, pass the method to perform the method logic, do not pass the default jump to the new TAB. | function(file): void | Jump to new TAB | 1.5.0 |
5656
| drop | A callback function executed when files are dragged and dropped into upload area | (event: DragEvent) => void | - | 3.0 |
57-
| preview | A callback function, will be executed when file link or preview icon is clicked. | Function(file) | - | |
58-
| reject | A callback function, will be executed when drop files is not accept. | Function(fileList) | - | |
57+
| preview | A callback function, will be executed when file link or preview icon is clicked. | function(file) | - | |
58+
| reject | A callback function, will be executed when drop files is not accept. | function(fileList) | - | |
5959
| remove   | A callback function, will be executed when removing file button is clicked, remove event will be prevented when return value is false or a Promise which resolve(false) or reject | function(file): boolean \| Promise | -   | 3.0 |
6060

6161
### UploadFile

components/upload/index.zh-CN.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/QaeBt_ZMg/Upload.svg
2323
| accept | 接受上传的文件类型, 详见 [input accept Attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept) | string || | |
2424
| action | 上传的地址 | string\|(file) => `Promise` || | |
2525
| beforeUpload | 上传文件之前的钩子,参数为上传的文件,若返回 `false` 则停止上传。支持返回一个 Promise 对象,Promise 对象 reject 时则停止上传,resolve 时开始上传( resolve 传入 `File``Blob` 对象则上传 resolve 传入对象)。 | (file, fileList) => `boolean` \| `Promise` || |
26-
| customRequest | 通过覆盖默认的上传行为,可以自定义自己的上传实现 | Function || | |
26+
| customRequest | 通过覆盖默认的上传行为,可以自定义自己的上传实现 | function || | |
2727
| data | 上传所需参数或返回上传参数的方法 | object\|(file) => object || | |
2828
| directory | 支持上传文件夹([caniuse](https://caniuse.com/#feat=input-file-directory)| boolean | false | 3.0 | |
2929
| disabled | 是否禁用 | boolean | false | | |
@@ -32,7 +32,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/QaeBt_ZMg/Upload.svg
3232
| headers | 设置上传的请求头部,IE10 以上有效 | object || | |
3333
| iconRender | 自定义显示 icon | v-slot:iconRender="{file: UploadFile, listType?: UploadListType}" | - | 3.0 | |
3434
| isImageUrl | 自定义缩略图是否使用 &lt;img /> 标签进行显示 | (file: UploadFile) => boolean | - | 3.0 | |
35-
| itemRender | 自定义上传列表项 | v-slot:itemRender="{originNode: ReactElement, file: UploadFile, fileList: object\[], actions: { download: function, preview: function, remove: function }" | - | 3.0 | |
35+
| itemRender | 自定义上传列表项 | v-slot:itemRender="{originNode: VNode, file: UploadFile, fileList: object\[], actions: { download: function, preview: function, remove: function }" | - | 3.0 | |
3636
| listType | 上传列表的内建样式,支持三种基本样式 `text`, `picture``picture-card` | string | `text` | | |
3737
| maxCount | 限制上传数量。当为 1 时,始终用最新上传的文件代替当前文件 | number | - | 3.0 | |
3838
| method | 上传请求的 http method | string | `post` | 1.5.0 | |
@@ -43,19 +43,19 @@ cover: https://gw.alipayobjects.com/zos/alicdn/QaeBt_ZMg/Upload.svg
4343
| previewIcon | 自定义预览 icon | v-slot:iconRender="{file: UploadFile}" | - | 3.0 | |
4444
| progress | 自定义进度条样式 | [ProgressProps](/components/progress/#API)(仅支持 `type="line"`| { strokeWidth: 2, showInfo: false } | 3.0 | |
4545
| removeIcon | 自定义删除 icon | v-slot:iconRender="{file: UploadFile}" | - | 3.0 | |
46-
| showUploadList | 是否展示 uploadList, 可设为一个对象,用于单独设定 showPreviewIcon, showRemoveIcon 和 showDownloadIcon | Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean, showDownloadIcon?: boolean } | true | showDownloadIcon(3.0) | |
46+
| showUploadList | 是否展示 uploadList, 可设为一个对象,用于单独设定 showPreviewIcon, showRemoveIcon 和 showDownloadIcon | boolean \| { showPreviewIcon?: boolean, showRemoveIcon?: boolean, showDownloadIcon?: boolean } | true | showDownloadIcon(3.0) | |
4747
| supportServerRender | 服务端渲染时需要打开这个 | boolean | false | | |
4848
| withCredentials | 上传请求时是否携带 cookie | boolean | false | | |
4949

5050
### 事件
5151

5252
| 事件名称 | 说明 | 回调参数 | 版本 | |
5353
| --- | --- | --- | --- | --- |
54-
| change | 上传文件改变时的状态,详见 [change](#change) | Function || |
55-
| download | 点击下载文件时的回调,如果没有指定,则默认跳转到文件 url 对应的标签页。 | Function(file): void | 跳转新标签页 | 1.5.0 |
54+
| change | 上传文件改变时的状态,详见 [change](#change) | function || |
55+
| download | 点击下载文件时的回调,如果没有指定,则默认跳转到文件 url 对应的标签页。 | function(file): void | 跳转新标签页 | 1.5.0 |
5656
| drop | 当文件被拖入上传区域时执行的回调功能 | (event: DragEvent) => void | - | 3.0 |
57-
| preview | 点击文件链接或预览图标时的回调 | Function(file) || |
58-
| reject | 拖拽文件不符合 accept 类型时的回调 | Function(fileList) || |
57+
| preview | 点击文件链接或预览图标时的回调 | function(file) || |
58+
| reject | 拖拽文件不符合 accept 类型时的回调 | function(fileList) || |
5959
| remove   | 点击移除文件时的回调,返回值为 false 时不移除。支持返回一个 Promise 对象,Promise 对象 resolve(false) 或 reject 时不移除 | function(file): boolean \| Promise | -   | 3.0 |
6060

6161
### UploadFile

0 commit comments

Comments
 (0)