Skip to content

Commit

Permalink
docs: update faq doc (#2993)
Browse files Browse the repository at this point in the history
  • Loading branch information
vthinkxie committed Feb 28, 2019
1 parent b33fe7a commit dbcf782
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 751 deletions.
91 changes: 48 additions & 43 deletions components/list/demo/infinite-load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,55 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
import { BehaviorSubject, Observable, Subscription } from 'rxjs';

@Component({
selector: 'nz-demo-list-infinite-load',
template: `
<div>
<cdk-virtual-scroll-viewport
itemSize="73"
class="demo-infinite-container"
>
<nz-list>
<nz-list-item *cdkVirtualFor="let item of ds">
<nz-skeleton
*ngIf="!item"
[nzAvatar]="true"
[nzParagraph]="{ rows: 1 }"
></nz-skeleton>
<nz-list-item-meta
*ngIf="item"
[nzTitle]="nzTitle"
nzAvatar="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
[nzDescription]="item.email"
>
<ng-template #nzTitle>
<a href="https://ng.ant.design">{{item.name.last}}</a>
</ng-template>
</nz-list-item-meta>
</nz-list-item>
</nz-list>
</cdk-virtual-scroll-viewport>
</div>
selector : 'nz-demo-list-infinite-load',
template : `
<div>
<cdk-virtual-scroll-viewport
itemSize="73"
class="demo-infinite-container"
>
<nz-list>
<nz-list-item *cdkVirtualFor="let item of ds">
<nz-skeleton
*ngIf="!item"
[nzAvatar]="true"
[nzParagraph]="{ rows: 1 }"
></nz-skeleton>
<nz-list-item-meta
*ngIf="item"
[nzTitle]="nzTitle"
nzAvatar="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
[nzDescription]="item.email"
>
<ng-template #nzTitle>
<a href="https://ng.ant.design">{{item.name.last}}</a>
</ng-template>
</nz-list-item-meta>
</nz-list-item>
</nz-list>
</cdk-virtual-scroll-viewport>
</div>
`,
styles: [
`
styles : [
`
.demo-infinite-container {
height: 300px;
border: 1px solid #e8e8e8;
border-radius: 4px;
}
nz-list {
padding: 24px;
}
`
],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class NzDemoListInfiniteLoadComponent {
ds = new MyDataSource(this.http);

constructor(private http: HttpClient) {}
constructor(private http: HttpClient) {
}
}

class MyDataSource extends DataSource<string | undefined> {
Expand Down Expand Up @@ -91,18 +96,18 @@ class MyDataSource extends DataSource<string | undefined> {
this.fetchedPages.add(page);

this.http
.get(
`https://randomuser.me/api/?results=${
this.pageSize
.get(
`https://randomuser.me/api/?results=${
this.pageSize
}&inc=name,gender,email,nat&noinfo`
)
.subscribe((res: any) => {
this.cachedData.splice(
page * this.pageSize,
this.pageSize,
...res.results
);
this.dataStream.next(this.cachedData);
});
)
.subscribe((res: any) => {
this.cachedData.splice(
page * this.pageSize,
this.pageSize,
...res.results
);
this.dataStream.next(this.cachedData);
});
}
}
2 changes: 1 addition & 1 deletion components/modal/doc/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The dialog is currently divided into 2 modes, `normal mode` and `confirm box mod
| nzMask | Whether show mask or not. | `boolean` | `true` |
| nzMaskClosable | Whether to close the modal dialog when the mask (area outside the modal) is clicked | `boolean` | `true` |
| nzMaskStyle | Style for modal's mask element. | `object` | - |
| nzOkText | Text of the OK button. <i>Set to null to show no cancel button (this value is invalid if the nzFooter parameter is used in normal mode)</i> | `string` | OK |
| nzOkText | Text of the OK button. <i>Set to null to show no ok button (this value is invalid if the nzFooter parameter is used in normal mode)</i> | `string` | OK |
| nzOkType | Button type of the OK button. <i>Consistent with the type of the `nz-button`.</i> | `string` | primary |
| nzStyle | Style of floating layer, typically used at least for adjusting the position. | `object` | - |
| nzTitle | The modal dialog's title. <i>Leave blank to show no title. The usage of TemplateRef can refer to the case</i> | string / TemplateRef | - |
Expand Down
2 changes: 1 addition & 1 deletion components/modal/doc/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ title: Modal
| nzMask | 是否展示遮罩 | `boolean` | `true` |
| nzMaskClosable | 点击蒙层是否允许关闭 | `boolean` | `true` |
| nzMaskStyle | 遮罩样式 | `object` | - |
| nzOkText | 确认按钮文字。<i>设为 null 表示不显示取消按钮(若在普通模式下使用了 nzFooter 参数,则该值无效)</i> | `string` | 确定 |
| nzOkText | 确认按钮文字。<i>设为 null 表示不显示确认按钮(若在普通模式下使用了 nzFooter 参数,则该值无效)</i> | `string` | 确定 |
| nzOkType | 确认按钮类型。<i>与button的type类型值一致</i> | `string` | primary |
| nzStyle | 可用于设置浮层的样式,调整浮层位置等 | `object` | - |
| nzTitle | 标题。<i>留空表示不展示标题。TemplateRef的使用方法可参考案例</i> | string<br>TemplateRef | - |
Expand Down
Loading

0 comments on commit dbcf782

Please sign in to comment.