Skip to content

Commit

Permalink
docs: fix upload format (#1272)
Browse files Browse the repository at this point in the history
- fix scroll to top when changed router
- support `/divider/zh#api` link scroll to api view
  • Loading branch information
cipchk authored and vthinkxie committed Apr 9, 2018
1 parent d952bd6 commit c3b9c39
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions components/upload/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ Uploading is the process of publishing information (web pages, text, pictures, v
| nzSize | limit file size (KB). `0` unlimited | number | 0 |
| nzFileType | limit file type, e.g: `image/png,image/jpeg,image/gif,image/bmp` | string | - |
| nzFilter | Custom filter when choosed file | UploadFilter[] | - |
| nzHeaders | Set request headers, valid above IE10. NOTICE: Muse be use `=>` to define the method. | `Object|((file: UploadFile) => Object)` | - |
| nzHeaders | Set request headers, valid above IE10. NOTICE: Muse be use `=>` to define the method. | `Object((file: UploadFile) => Object)` | - |
| nzListType | Built-in stylesheets, support for three types: `text`, `picture` or `picture-card` | string | 'text' |
| nzMultiple | Whether to support selected multiple file. `IE10+` supported. You can select multiple files with CTRL holding down while multiple is set to be true | boolean | false |
| nzName | The name of uploading file | string | 'file' |
| nzShowUploadList | Whether to show default upload list, could be an object to specify `showPreviewIcon` and `showRemoveIcon` individually | `Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean }` | true |
| nzShowButton | Show upload button | boolean | true |
| nzWithCredentials | ajax upload with cookie sent | boolean | false |
| nzPreview | A callback function, will be executed when file link or preview icon is clicked. NOTICE: Muse be use `=>` to define the method. | `(file: UploadFile) => void` | - |
| nzRemove | A callback function, will be executed when removing file button is clicked, remove event will be prevented when return value is `false` or a Observable. NOTICE: Muse be use `=>` to define the method. | (file: UploadFile) => `boolean|Observable` | - |
| nzRemove | A callback function, will be executed when removing file button is clicked, remove event will be prevented when return value is `false` or a Observable. NOTICE: Muse be use `=>` to define the method. | (file: UploadFile) => `booleanObservable` | - |
| (nzChange) | A callback function, can be executed when uploading state is changing | EventEmitter | - |

## nzChange
Expand Down
4 changes: 2 additions & 2 deletions components/upload/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ title: Upload
| nzSize | 限制文件大小,单位:KB;`0` 表示不限 | number | 0 |
| nzFileType | 限制文件类型,例如:`image/png,image/jpeg,image/gif,image/bmp` | string | - |
| nzFilter | 自定义过滤器 | UploadFilter[] | - |
| nzHeaders | 设置上传的请求头部,IE10 以上有效;注意:务必使用 `=>` 定义处理方法。 | `Object|((file: UploadFile) => Object)` | - |
| nzHeaders | 设置上传的请求头部,IE10 以上有效;注意:务必使用 `=>` 定义处理方法。 | `Object((file: UploadFile) => Object)` | - |
| nzListType | 上传列表的内建样式,支持三种基本样式 `text`, `picture``picture-card` | string | 'text' |
| nzMultiple | 是否支持多选文件,`ie10+` 支持。开启后按住 ctrl 可选择多个文件。 | boolean | false |
| nzName | 发到后台的文件参数名 | string | 'file' |
| nzShowUploadList | 是否展示 uploadList, 可设为一个对象,用于单独设定 showPreviewIcon 和 showRemoveIcon | `Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean }` | true |
| nzShowButton | 是否展示上传按钮 | boolean | true |
| nzWithCredentials | 上传请求时是否携带 cookie | boolean | false |
| nzPreview | 点击文件链接或预览图标时的回调;注意:务必使用 `=>` 定义处理方法。 | `(file: UploadFile) => void` | - |
| nzRemove | 点击移除文件时的回调,返回值为 false 时不移除。支持返回 `Observable` 对象;注意:务必使用 `=>` 定义处理方法。 | (file: UploadFile) => `boolean|Observable` ||
| nzRemove | 点击移除文件时的回调,返回值为 false 时不移除。支持返回 `Observable` 对象;注意:务必使用 `=>` 定义处理方法。 | (file: UploadFile) => `booleanObservable` ||
| (nzChange) | 上传文件改变时的状态 | EventEmitter | - |

## nzChange
Expand Down
8 changes: 7 additions & 1 deletion site_scripts/_site/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,15 @@ export class AppComponent implements OnInit {
}
this.language = this.router.url.split('/')[ this.router.url.split('/').length - 1 ].split('#')[ 0 ];
this.nzI18nService.setLocale(this.language === 'en' ? en_US : zh_CN);
if (environment.production && (this.router.url.indexOf('#') < -1)) {
if (environment.production) {
window.scrollTo(0, 0);
}
setTimeout(() => {
const toc = this.router.parseUrl(this.router.url).fragment || '';
if (toc) {
document.querySelector(`#${toc}`).scrollIntoView();
}
}, 200);
}
});
this.initColor();
Expand Down

0 comments on commit c3b9c39

Please sign in to comment.