diff --git a/components/skeleton/demo/basic.md b/components/skeleton/demo/basic.md
index ecba901a68e..41d61a35ec7 100644
--- a/components/skeleton/demo/basic.md
+++ b/components/skeleton/demo/basic.md
@@ -1,5 +1,5 @@
---
-order: 0
+order: 1
title:
zh-CN: 基础列表样例
en-US: Basic List Sample
diff --git a/components/skeleton/demo/basic.ts b/components/skeleton/demo/basic.ts
index 852bcc3c09b..85542c1b89d 100644
--- a/components/skeleton/demo/basic.ts
+++ b/components/skeleton/demo/basic.ts
@@ -1,4 +1,4 @@
-import { Component, OnInit } from '@angular/core';
+import { Component } from '@angular/core';
@Component({
selector: 'nz-demo-skeleton-basic',
@@ -7,7 +7,7 @@ import { Component, OnInit } from '@angular/core';
-
+
- `,
- styles: [`
- .skeleton-demo {
- border: 1px solid #f4f4f4;
- }
- `]
+ `
})
-export class NzDemoSkeletonBasicComponent implements OnInit {
- listData = [];
+export class NzDemoSkeletonBasicComponent {
loading = true;
-
- ngOnInit(): void {
- for (let i = 0; i < 9; i++) {
- this.listData.push({
- title: `ant design ${i}`,
- description: 'Ant Design, a design language for background applications, is refined by Ant UED Team.'
- });
- }
- }
+ listData = new Array(8).fill({}).map((i, index) => {
+ return {
+ title: `ant design ${index}`,
+ description: 'Ant Design, a design language for background applications, is refined by Ant UED Team.'
+ };
+ });
}
diff --git a/components/skeleton/demo/card.md b/components/skeleton/demo/card.md
index a3ffec950fc..6b0f5880b1a 100644
--- a/components/skeleton/demo/card.md
+++ b/components/skeleton/demo/card.md
@@ -1,5 +1,5 @@
---
-order: 1
+order: 0
title:
zh-CN: 卡片样例
en-US: Card Sample
diff --git a/components/skeleton/demo/card.ts b/components/skeleton/demo/card.ts
index 5a15d0ed3d2..d094a8ffaa8 100644
--- a/components/skeleton/demo/card.ts
+++ b/components/skeleton/demo/card.ts
@@ -5,9 +5,9 @@ import { Component } from '@angular/core';
template: `
-
+
diff --git a/components/skeleton/demo/list.md b/components/skeleton/demo/list.md
new file mode 100644
index 00000000000..2142dee87ab
--- /dev/null
+++ b/components/skeleton/demo/list.md
@@ -0,0 +1,14 @@
+---
+order: 2
+title:
+ zh-CN: 列表样例
+ en-US: List Sample
+---
+
+## zh-CN
+
+在列表组件中使用加载占位符。
+
+## en-US
+
+Use skeleton in list component.
\ No newline at end of file
diff --git a/components/skeleton/demo/list.ts b/components/skeleton/demo/list.ts
new file mode 100644
index 00000000000..b57106aca6f
--- /dev/null
+++ b/components/skeleton/demo/list.ts
@@ -0,0 +1,40 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'nz-demo-skeleton-list',
+ template: `
+
+
+
+
+
+ 156
+ 156
+ 2
+
+ {{item.title}}
+
+
+
+
+
+
+
+
+ `
+})
+export class NzDemoSkeletonListComponent {
+ loading = true;
+ listData = new Array(4).fill({}).map((i, index) => {
+ return {
+ href: 'http://ng.ant.design',
+ title: `ant design part ${index}`,
+ avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png',
+ description: 'Ant Design, a design language for background applications, is refined by Ant UED Team.',
+ content: 'We supply a series of design principles, practical patterns and high quality design resources (Sketch and Axure), to help people create their product prototypes beautifully and efficiently.'
+ };
+ });
+}
diff --git a/components/skeleton/nz-skeleton.component.html b/components/skeleton/nz-skeleton.component.html
index ffb06b4456e..c6db0c56723 100644
--- a/components/skeleton/nz-skeleton.component.html
+++ b/components/skeleton/nz-skeleton.component.html
@@ -6,9 +6,9 @@
diff --git a/components/skeleton/nz-skeleton.component.ts b/components/skeleton/nz-skeleton.component.ts
index 991923001d3..a2e6bde9422 100644
--- a/components/skeleton/nz-skeleton.component.ts
+++ b/components/skeleton/nz-skeleton.component.ts
@@ -9,12 +9,11 @@ import { NzSkeletonAvatar, NzSkeletonParagraph, NzSkeletonTitle } from './nz-ske
}
})
export class NzSkeletonComponent implements OnInit, OnChanges {
+ title: NzSkeletonTitle = {};
+ avatar: NzSkeletonAvatar = {};
+ paragraph: NzSkeletonParagraph = {};
+ widthList: Array = [];
avartarClassMap;
- private _title: NzSkeletonTitle = {};
- private _avatar: NzSkeletonAvatar = {};
- private _paragraph: NzSkeletonParagraph = {};
- private _widthList: Array = [];
- private prefixCls = 'ant-skeleton';
@Input() nzLoading = true;
@Input() nzTitle: NzSkeletonTitle | boolean = true;
@@ -62,7 +61,7 @@ export class NzSkeletonComponent implements OnInit, OnChanges {
return {};
}
- toCSSUnit(value: number | string = ''): number | string {
+ toCSSUnit(value: number | string = ''): string {
if (typeof value === 'number') {
return `${value}px`;
} else if (typeof value === 'string') {
@@ -75,7 +74,7 @@ export class NzSkeletonComponent implements OnInit, OnChanges {
}
getWidthList(): Array {
- const { width, rows } = this._paragraph;
+ const { width, rows } = this.paragraph;
let widthList = [];
if (width && Array.isArray(width)) {
widthList = width;
@@ -88,27 +87,27 @@ export class NzSkeletonComponent implements OnInit, OnChanges {
updateClassMap(): void {
this.avartarClassMap = {
- [ `${this.prefixCls}-avatar-lg` ] : this._avatar.size === 'large',
- [ `${this.prefixCls}-avatar-sm ` ] : this._avatar.size === 'small',
- [ `${this.prefixCls}-avatar-circle` ] : this._avatar.shape === 'circle',
- [ `${this.prefixCls}-avatar-square ` ]: this._avatar.shape === 'square'
+ [ `ant-skeleton-avatar-lg` ] : this.avatar.size === 'large',
+ [ `ant-skeleton-avatar-sm ` ] : this.avatar.size === 'small',
+ [ `ant-skeleton-avatar-circle` ] : this.avatar.shape === 'circle',
+ [ `ant-skeleton-avatar-square ` ]: this.avatar.shape === 'square'
};
}
updateProps(): void {
- this._title = {
+ this.title = {
...this.getTitleBasicProps(!!this.nzAvatar, !!this.nzParagraph),
...this.getProps(this.nzTitle)
};
- this._avatar = {
+ this.avatar = {
...this.getAvatarBasicProps(!!this.nzTitle, !!this.nzParagraph),
...this.getProps(this.nzAvatar)
};
- this._paragraph = {
+ this.paragraph = {
...this.getParagraphBasicProps(!!this.nzAvatar, !!this.nzTitle),
...this.getProps(this.nzParagraph)
};
- this._widthList = this.getWidthList();
+ this.widthList = this.getWidthList();
}
ngOnInit(): void {