Skip to content

fix: typo #6218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions components/affix/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,30 +110,30 @@ const Affix = defineComponent({
status: AffixStatus.None,
} as AffixState;
const targetRect = getTargetRect(targetNode);
const placeholderReact = getTargetRect(placeholderNode.value as HTMLElement);
const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop.value);
const fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom.value);
const placeholderRect = getTargetRect(placeholderNode.value as HTMLElement);
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop.value);
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom.value);
if (fixedTop !== undefined) {
newState.affixStyle = {
position: 'fixed',
top: fixedTop,
width: placeholderReact.width + 'px',
height: placeholderReact.height + 'px',
width: placeholderRect.width + 'px',
height: placeholderRect.height + 'px',
};
newState.placeholderStyle = {
width: placeholderReact.width + 'px',
height: placeholderReact.height + 'px',
width: placeholderRect.width + 'px',
height: placeholderRect.height + 'px',
};
} else if (fixedBottom !== undefined) {
newState.affixStyle = {
position: 'fixed',
bottom: fixedBottom,
width: placeholderReact.width + 'px',
height: placeholderReact.height + 'px',
width: placeholderRect.width + 'px',
height: placeholderRect.height + 'px',
};
newState.placeholderStyle = {
width: placeholderReact.width + 'px',
height: placeholderReact.height + 'px',
width: placeholderRect.width + 'px',
height: placeholderRect.height + 'px',
};
}

Expand Down Expand Up @@ -169,9 +169,9 @@ const Affix = defineComponent({
const targetNode = target();
if (targetNode && placeholderNode.value) {
const targetRect = getTargetRect(targetNode);
const placeholderReact = getTargetRect(placeholderNode.value as HTMLElement);
const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop.value);
const fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom.value);
const placeholderRect = getTargetRect(placeholderNode.value as HTMLElement);
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop.value);
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom.value);
if (
(fixedTop !== undefined && affixStyle.top === fixedTop) ||
(fixedBottom !== undefined && affixStyle.bottom === fixedBottom)
Expand Down
8 changes: 4 additions & 4 deletions components/affix/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ export function getTargetRect(target: BindElement): DOMRect {
: ({ top: 0, bottom: window.innerHeight } as DOMRect);
}

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

export function getFixedBottom(
placeholderReact: DOMRect,
placeholderRect: DOMRect,
targetRect: DOMRect,
offsetBottom: number,
) {
if (offsetBottom !== undefined && targetRect.bottom < placeholderReact.bottom + offsetBottom) {
if (offsetBottom !== undefined && targetRect.bottom < placeholderRect.bottom + offsetBottom) {
const targetBottomOffset = window.innerHeight - targetRect.bottom;
return `${offsetBottom + targetBottomOffset}px`;
}
Expand Down
14 changes: 7 additions & 7 deletions components/upload/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Uploading is the process of publishing information (web pages, text, pictures, v
| 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 | - | | |
| action | Uploading URL | string\|(file) => `Promise` | - | | |
| beforeUpload | Hook function which will be executed before uploading. Uploading will be stopped with `false` or a rejected Promise returned. | (file, fileList) => `boolean` \| `Promise` | - | |
| customRequest | override for the default xhr behavior allowing for additional customization and ability to implement your own XMLHttpRequest | Function | - | | |
| customRequest | override for the default xhr behavior allowing for additional customization and ability to implement your own XMLHttpRequest | function | - | | |
| data | Uploading params or function which can return uploading params. | object\|function(file) | - | | |
| directory | support upload whole directory ([caniuse](https://caniuse.com/#feat=input-file-directory)) | boolean | false | | |
| directory | Support upload whole directory([caniuse](https://caniuse.com/#feat=input-file-directory)| boolean | false | 3.0 | |
Expand All @@ -32,7 +32,7 @@ Uploading is the process of publishing information (web pages, text, pictures, v
| headers | Set request headers, valid above IE10. | object | - | | |
| iconRender | Custom show icon | v-slot:iconRender="{file: UploadFile, listType?: UploadListType}" | - | 3.0 | |
| isImageUrl | Customize if render &lt;img /> in thumbnail | (file: UploadFile) => boolean | - | 3.0 | |
| itemRender | Custom item of uploadList | v-slot:itemRender="{originNode: ReactElement, file: UploadFile, fileList: object\[], actions: { download: function, preview: function, remove: function }" | - | 3.0 | |
| itemRender | Custom item of uploadList | v-slot:itemRender="{originNode: VNode, file: UploadFile, fileList: object\[], actions: { download: function, preview: function, remove: function }" | - | 3.0 | |
| listType | Built-in stylesheets, support for three types: `text`, `picture` or `picture-card` | string | `text` | | |
| maxCount | Limit the number of uploaded files. Will replace current one when `maxCount` is `1` | number | - | 3.0 | |
| method | http method of upload request | string | `post` | 1.5.0 | |
Expand All @@ -43,19 +43,19 @@ Uploading is the process of publishing information (web pages, text, pictures, v
| previewIcon | custom preview icon | v-slot:iconRender="{file: UploadFile}" | - | 3.0 | |
| progress | Custom progress bar | [ProgressProps](/components/progress/#API) (support `type="line"` only) | { strokeWidth: 2, showInfo: false } | 3.0 | |
| removeIcon | custom remove icon | v-slot:iconRender="{file: UploadFile}" | - | 3.0 | |
| 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) | |
| 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) | |
| supportServerRender | Need to be turned on while the server side is rendering. | boolean | false | | |
| withCredentials | ajax upload with cookie sent | boolean | false | | |

### events

| Events Name | Description | Arguments | Version | |
| --- | --- | --- | --- | --- |
| change | A callback function, can be executed when uploading state is changing. See [change](#change) | Function | - | |
| 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 |
| change | A callback function, can be executed when uploading state is changing. See [change](#change) | function | - | |
| 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 |
| drop | A callback function executed when files are dragged and dropped into upload area | (event: DragEvent) => void | - | 3.0 |
| preview | A callback function, will be executed when file link or preview icon is clicked. | Function(file) | - | |
| reject | A callback function, will be executed when drop files is not accept. | Function(fileList) | - | |
| preview | A callback function, will be executed when file link or preview icon is clicked. | function(file) | - | |
| reject | A callback function, will be executed when drop files is not accept. | function(fileList) | - | |
| 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 |

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

### 事件

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

### UploadFile
Expand Down