Skip to content

Commit

Permalink
Merge pull request #276 from aotuzuche/feat/tableaddprops
Browse files Browse the repository at this point in the history
feat: 🎸 table添加setSearchBarFieldsValue
  • Loading branch information
liuxingyun2010 authored Jul 19, 2022
2 parents 994b215 + 7cd69ff commit 7050f2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions components/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export interface TableRef {
*/
refresh: () => Promise<unknown>
getSearchBarFieldsValue: () => any
setSearchBarFieldsValue: (obj: any) => any
}

// eslint-disable-next-line @typescript-eslint/ban-types
Expand Down Expand Up @@ -242,6 +243,8 @@ function Table<RecordType extends object>(

const getSearchBarFieldsValue = () => form.getFieldsValue(true)

const setSearchBarFieldsValue = (obj: any) => form.setFieldsValue(obj)

const onClickSearch = () => {
setState({
pageNum: 1,
Expand Down Expand Up @@ -426,6 +429,7 @@ function Table<RecordType extends object>(
useImperativeHandle(ref, () => ({
refresh,
getSearchBarFieldsValue,
setSearchBarFieldsValue,
}))

return (
Expand Down
8 changes: 5 additions & 3 deletions components/table/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ group:

#### Table Instance Methods

| 属性 | 描述 | 类型 | 默认值 |
| refresh | 刷新 table 数据 | function | void |
| getSearchBarFieldsValue | function | any |
| 属性 | 描述 | 类型 | 默认值 |
| ----------------------- | --------------- | -------- | ------ |
| refresh | 刷新 table 数据 | function | void |
| getSearchBarFieldsValue | 获取搜索框的值 | function | any |
| setSearchBarFieldsValue | 设置搜索框的值 | function | any |

1 comment on commit 7050f2d

@vercel
Copy link

@vercel vercel bot commented on 7050f2d Jul 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.