Skip to content

Commit 5b4d30c

Browse files
committed
docs: add docs and demo
1 parent 89de910 commit 5b4d30c

File tree

7 files changed

+96
-8
lines changed

7 files changed

+96
-8
lines changed

components/config-provider/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const ConfigProvider = {
4646
},
4747
methods: {
4848
renderEmptyComponent() {
49-
const customRender = getComponentFromProp(this,'renderEmpty');
49+
const customRender = getComponentFromProp(this,'renderEmpty', {}, false);
5050
return this.$props.renderEmpty || customRender || defaultRenderEmpty;
5151
},
5252
getPrefixCls(suffixCls, customizePrefixCls) {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import demoTest from '../../../tests/shared/demoTest';
2+
3+
demoTest('empty');

components/empty/demo/config-provider.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ Use ConfigProvider set global Empty style.
2121
<a-divider />
2222
<a-config-provider>
2323
<template v-if="customize" v-slot:renderEmpty>
24-
<div style="textAlign: center">
25-
<a-icon type="smile" style="fontSize: 20px" />
24+
<div style="text-align: center">
25+
<a-icon type="smile" style="font-size: 20px" />
2626
<p>Data Not Found</p>
2727
</div>
2828
</template>
2929
<div class="config-provider">
3030
<h3>Select</h3>
31-
<a-select :style="style" />
31+
<a-select :style="style" :options="[]" />
3232

3333
<h3>TreeSelect</h3>
3434
<a-tree-select :style="style" :treeData="[]" />
@@ -37,15 +37,16 @@ Use ConfigProvider set global Empty style.
3737
<a-cascader :style="style" :options="[]" :showSearch="true" />
3838

3939
<h3>Transfer</h3>
40-
<a-transfer />
40+
<a-transfer :dataSource="[]" />
4141

4242
<h3>Table</h3>
4343
<a-table
44-
style="marginTop: 8px"
44+
style="margin-top: 8px"
4545
:columns="columns"
46+
:dataSource="[]"
4647
/>
4748
<h3>List</h3>
48-
<a-list />
49+
<a-list :dataSource="[]" />
4950
</div>
5051
</a-config-provider>
5152
</div>
@@ -69,7 +70,7 @@ export default {
6970
},
7071
]
7172
}
72-
},
73+
}
7374
}
7475
7576
</script>

components/empty/demo/index.vue

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<script>
2+
import Basic from './basic';
3+
import ConfigProvider from './config-provider';
4+
import Customize from './customize';
5+
6+
import CN from '../index.zh-CN.md';
7+
import US from '../index.en-US.md';
8+
9+
import '../style';
10+
11+
const md = {
12+
cn: `# 空状态
13+
空状态时的展示占位图。
14+
15+
空状态时的展示占位图。
16+
17+
## 何时使用
18+
19+
当目前没有数据时,用于显式的用户提示。
20+
21+
## 代码演示
22+
`,
23+
us: `# Empty
24+
Empty state placeholder.
25+
26+
## When To Use
27+
28+
When there is no data provided, display for friendly tips.
29+
## Examples
30+
`,
31+
};
32+
export default {
33+
category: 'Components',
34+
type: 'Data Display',
35+
title: 'Empty',
36+
subtitle: '空状态',
37+
render () {
38+
return (
39+
<div>
40+
<md cn={md.cn} us={md.us} />
41+
<Basic />
42+
<ConfigProvider />
43+
<Customize />
44+
<api>
45+
<CN slot='cn' />
46+
<US />
47+
</api>
48+
</div>
49+
);
50+
},
51+
};
52+
</script>

components/empty/index.en-US.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## API
2+
3+
```jsx
4+
<Empty>
5+
<Button>Create</Button>
6+
</Empty>
7+
```
8+
9+
| Property | Description | Type | Default |
10+
| -------- | ----------- | ---- | ------- |
11+
| description | Customize description | string \| v-slot | - |
12+
| image | Customize image. Will tread as image url when string provided | string \| v-slot | false |

components/empty/index.zh-CN.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
## API
2+
3+
```jsx
4+
<Empty>
5+
<Button>创建</Button>
6+
</Empty>
7+
```
8+
9+
| 参数 | 说明 | 类型 | 默认值 |
10+
| --- | --- | --- | --- |
11+
| description | 自定义描述内容 | string \| v-slot | - |
12+
| image | 设置显示图片,为 string 时表示自定义图片地址 | string \| v-slot | false |

site/demoRoutes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,4 +439,12 @@ export default [
439439
path: 'config-provider-cn',
440440
component: () => import('../components/config-provider/demo/index.vue'),
441441
},
442+
{
443+
path: 'empty',
444+
component: () => import('../components/empty/demo/index.vue'),
445+
},
446+
{
447+
path: 'empty-cn',
448+
component: () => import('../components/empty/demo/index.vue'),
449+
},
442450
];

0 commit comments

Comments
 (0)