Skip to content

Commit

Permalink
feat: doc
Browse files Browse the repository at this point in the history
  • Loading branch information
stbui committed Jun 12, 2020
1 parent 39a8cde commit f856622
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 14 deletions.
28 changes: 25 additions & 3 deletions docs/antd/Edit.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
# Edit

Edit 组件
编辑组件

## 示例

```js
import { Edit } from '@stbui/prophet-antd';

const EditView = props => {
const { record, save } = props;
const onSubmit = params => save(params);

return (
<div>
<div>{record.username}</div>
<button onClick={onSubmit}>提交</button>
</div>
);
};

export default props => (
<Edit title="编辑" {...props}>
<EditView />
</Edit>
);
```

## 示例

Expand All @@ -17,8 +41,6 @@ const EditView = props => {
onFailure: error => {
console.log(error);
},
// 更新List数据
// refresh: true,
});

return (
Expand Down
69 changes: 58 additions & 11 deletions docs/antd/List.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,61 @@
# List

渲染数据列表
展示数据列表组件,可以将数据渲染到 table

## 示例
## 默认示例

```js
import { List, Datagrid, Column } from '@stbui/prophet-antd';

export default props => (
<List {...props}>
<Datagrid>
<Column>id</Column>
<Column>title</Column>
</Datagrid>
</List>
);
```

## 分页示例

```js
import { List, Datagrid, Column } from '@stbui/prophet-antd';

export default props => (
<List page={2} perPage={20} {...props}>
<Datagrid>
<Column>id</Column>
<Column>title</Column>
</Datagrid>
</List>
);
```

## 排序示例

```js
import { List, Datagrid, Column } from '@stbui/prophet-antd';

export default props => (
<List sort={{ field: 'id', order: 'ASC' }} {...props}>
<Datagrid>
<Column>id</Column>
<Column>title</Column>
</Datagrid>
</List>
);
```

## 过滤条件示例

```js
import { List, Datagrid, Column } from '@stbui/prophet-antd';

export default props => (
<List filter={{ name: 'stbui' }} {...props}>
<Datagrid>
<Column>id</Column>
<Column>title</Column>
</Datagrid>
</List>
Expand All @@ -18,12 +64,13 @@ export default props => (

## API

| 属性 | 类型 | 默认值 | 可选值/参数 | 说明 |
| :------------------ | :-------- | :----- | :----------- | :--- |
| resource | string | | | |
| basePath | string | | | |
| filterDefaultValues | object | | | |
| filter | object | | | |
| sort | object | | | |
| perPage | perPage | | | |
| actions | component | | | |
| 属性 | 类型 | 默认值 | 可选值/参数 | 说明 |
| :------------------ | :-------- | :-------------------------- | :----------- | :------------ |
| resource | string | - | | 资源标志 |
| basePath | string | - | | 当前资源 path |
| filterDefaultValues | object | - | | 默认过滤条件 |
| filter | object | - | | 过滤条件 |
| sort | object | {field: 'id', order: 'ASC'} | | 排序 |
| page | number | 1 | | 当前页数 |
| perPage | number | 10 | | 分页大小 |
| actions | component | <Actions> | | 过滤条件组件 |

0 comments on commit f856622

Please sign in to comment.