Skip to content

Commit 2bb74f3

Browse files
committed
docs(skeleton): update doc
1 parent 74acd21 commit 2bb74f3

File tree

4 files changed

+49
-24
lines changed

4 files changed

+49
-24
lines changed

src/skeleton/props.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,34 @@
22

33
/**
44
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5-
* updated at 2021-12-26 15:04:09
65
* */
76

87
import { TdSkeletonProps } from './type';
98
import { PropType } from 'vue';
109

1110
export default {
12-
/** 动画效果,有「渐变加载动画」和「闪烁加载动画」两种。值为空则表示没有动画 */
11+
/** 动画效果,有「渐变加载动画」和「闪烁加载动画」两种。值为 'none' 则表示没有动画 */
1312
animation: {
1413
type: String as PropType<TdSkeletonProps['animation']>,
14+
default: 'none' as TdSkeletonProps['animation'],
1515
validator(val: TdSkeletonProps['animation']): boolean {
16-
return ['gradient', 'flashed'].includes(val);
16+
if (!val) return true;
17+
return ['gradient', 'flashed', 'none'].includes(val);
1718
},
1819
},
20+
/** 加载完成的内容 */
21+
content: {
22+
type: [String, Function] as PropType<TdSkeletonProps['content']>,
23+
},
24+
/** 加载完成的内容,同 content */
25+
default: {
26+
type: [String, Function] as PropType<TdSkeletonProps['default']>,
27+
},
28+
/** 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 */
29+
delay: {
30+
type: Number,
31+
default: 0,
32+
},
1933
/** 是否为加载状态,如果是则显示骨架图,如果不是则显示加载完成的内容 */
2034
loading: {
2135
type: Boolean,
@@ -28,13 +42,10 @@ export default {
2842
/** 快捷定义骨架图风格,有基础、头像组合等,具体参看代码示例 */
2943
theme: {
3044
type: String as PropType<TdSkeletonProps['theme']>,
45+
default: 'text' as TdSkeletonProps['theme'],
3146
validator(val: TdSkeletonProps['theme']): boolean {
47+
if (!val) return true;
3248
return ['text', 'avatar', 'paragraph', 'avatar-text', 'tab', 'article'].includes(val);
3349
},
3450
},
35-
/** 延迟显示加载效果的事件,用于放置请求速度过快引起的家在闪烁,单位:毫秒 */
36-
delay: {
37-
type: Number,
38-
default: 0,
39-
},
4051
};

src/skeleton/skeleton.en-US.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
:: BASE_DOC ::
22

33
## API
4+
45
### Skeleton Props
56

67
name | type | default | description | required
78
-- | -- | -- | -- | --
8-
animation | String | none | options:gradient/flashed/none | N
9+
animation | String | none | options: gradient/flashed/none | N
10+
content | String / Slot / Function | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
11+
default | String / Slot / Function | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
912
delay | Number | 0 | \- | N
1013
loading | Boolean | true | \- | N
11-
rowCol | Array | - | Typescript:`SkeletonRowCol` `type SkeletonRowCol = Array<Number \| SkeletonRowColObj \| Array<SkeletonRowColObj>>` `interface SkeletonRowColObj { width?: string; height?: string; size?: string; marginRight?: string; marginLeft?: string; margin?: string; content?: string \| TNode; type?: 'rect' \| 'circle' \| 'text' }`[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/skeleton/type.ts) | N
12-
theme | String | text | optionstext/avatar/paragraph/avatar-text/tab/article | N
14+
rowCol | Array | - | Typescript:`SkeletonRowCol` `type SkeletonRowCol = Array<number \| SkeletonRowColObj \| Array<SkeletonRowColObj>>` `interface SkeletonRowColObj { width?: string; height?: string; size?: string; marginRight?: string; marginLeft?: string; margin?: string; content?: string \| TNode; type?: 'rect' \| 'circle' \| 'text' }`[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/skeleton/type.ts) | N
15+
theme | String | text | options: text/avatar/paragraph/avatar-text/tab/article | N

src/skeleton/skeleton.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
:: BASE_DOC ::
22

33
## API
4+
45
### Skeleton Props
56

6-
名称 | 类型 | 默认值 | 说明 | 必传
7+
名称 | 类型 | 默认值 | 描述 | 必传
78
-- | -- | -- | -- | --
89
animation | String | none | 动画效果,有「渐变加载动画」和「闪烁加载动画」两种。值为 'none' 则表示没有动画。可选项:gradient/flashed/none | N
9-
delay | Number | 0 | 【开发中】延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 | N
10+
content | String / Slot / Function | - | 加载完成的内容。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
11+
default | String / Slot / Function | - | 加载完成的内容,同 content。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
12+
delay | Number | 0 | 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 | N
1013
loading | Boolean | true | 是否为加载状态,如果是则显示骨架图,如果不是则显示加载完成的内容 | N
11-
rowCol | Array | - | 高级设置,用于自定义行列数量、宽度高度、间距等。【示例一】,`[1, 1, 2]` 表示输出三行骨架图,第一行一列,第二行一列,第三行两列。【示例二】,`[1, 1, { width: '100px' }]` 表示自定义第三行的宽度为 `100px`。【示例三】,`[1, 2, [{ width, height }, { width, height, marginLeft }]]` 表示第三行有两列,且自定义宽度、高度、尺寸(圆形或方形使用)、间距、内容等。TS 类型:`SkeletonRowCol` `type SkeletonRowCol = Array<Number \| SkeletonRowColObj \| Array<SkeletonRowColObj>>` `interface SkeletonRowColObj { width?: string; height?: string; size?: string; marginRight?: string; marginLeft?: string; margin?: string; content?: string \| TNode; type?: 'rect' \| 'circle' \| 'text' }`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/skeleton/type.ts) | N
14+
rowCol | Array | - | 高级设置,用于自定义行列数量、宽度高度、间距等。【示例一】,`[1, 1, 2]` 表示输出三行骨架图,第一行一列,第二行一列,第三行两列。【示例二】,`[1, 1, { width: '100px' }]` 表示自定义第三行的宽度为 `100px`。【示例三】,`[1, 2, [{ width, height }, { width, height, marginLeft }]]` 表示第三行有两列,且自定义宽度、高度、尺寸(圆形或方形使用)、间距、内容等。TS 类型:`SkeletonRowCol` `type SkeletonRowCol = Array<number \| SkeletonRowColObj \| Array<SkeletonRowColObj>>` `interface SkeletonRowColObj { width?: string; height?: string; size?: string; marginRight?: string; marginLeft?: string; margin?: string; content?: string \| TNode; type?: 'rect' \| 'circle' \| 'text' }`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/skeleton/type.ts) | N
1215
theme | String | text | 快捷定义骨架图风格,有基础、头像组合等,具体参看代码示例。可选项:text/avatar/paragraph/avatar-text/tab/article | N

src/skeleton/type.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,46 @@
22

33
/**
44
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5-
* updated at 2021-12-26 15:04:09
65
* */
76

87
import { TNode } from '../common';
98

109
export interface TdSkeletonProps {
1110
/**
12-
* 动画效果,有「渐变加载动画」和「闪烁加载动画」两种。值为空则表示没有动画
11+
* 动画效果,有「渐变加载动画」和「闪烁加载动画」两种。值为 'none' 则表示没有动画
12+
* @default none
1313
*/
14-
animation?: 'gradient' | 'flashed';
14+
animation?: 'gradient' | 'flashed' | 'none';
15+
/**
16+
* 加载完成的内容
17+
*/
18+
content?: string | TNode;
19+
/**
20+
* 加载完成的内容,同 content
21+
*/
22+
default?: string | TNode;
23+
/**
24+
* 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒
25+
* @default 0
26+
*/
27+
delay?: number;
1528
/**
1629
* 是否为加载状态,如果是则显示骨架图,如果不是则显示加载完成的内容
30+
* @default true
1731
*/
1832
loading?: boolean;
1933
/**
2034
* 高级设置,用于自定义行列数量、宽度高度、间距等。【示例一】,`[1, 1, 2]` 表示输出三行骨架图,第一行一列,第二行一列,第三行两列。【示例二】,`[1, 1, { width: '100px' }]` 表示自定义第三行的宽度为 `100px`。【示例三】,`[1, 2, [{ width, height }, { width, height, marginLeft }]]` 表示第三行有两列,且自定义宽度、高度、尺寸(圆形或方形使用)、间距、内容等
21-
* @default [1, 1, 1, { width: '70%' }]
2235
*/
2336
rowCol?: SkeletonRowCol;
2437
/**
2538
* 快捷定义骨架图风格,有基础、头像组合等,具体参看代码示例
2639
* @default text
2740
*/
2841
theme?: 'text' | 'avatar' | 'paragraph' | 'avatar-text' | 'tab' | 'article';
29-
/**
30-
* 延迟显示加载效果的事件,用于放置请求速度过快引起的家在闪烁,单位:毫秒
31-
* @default 0
32-
*/
33-
delay?: number;
3442
}
3543

36-
export type SkeletonRowCol = Array<Number | SkeletonRowColObj | Array<SkeletonRowColObj>>;
44+
export type SkeletonRowCol = Array<number | SkeletonRowColObj | Array<SkeletonRowColObj>>;
3745

3846
export interface SkeletonRowColObj {
3947
width?: string;

0 commit comments

Comments
 (0)