Skip to content

Commit

Permalink
doc(Table): 更新table组件文档 可编辑行例子的错误 (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuilanxin committed Apr 2, 2022
1 parent 06af728 commit 3a43b33
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions packages/react-table/README.md
Expand Up @@ -936,6 +936,7 @@ ReactDOM.render(<Demo />, _mount_);

<!--rehype:bgWhite=true&codeSandbox=true&codePen=true-->
```jsx
import React from 'react';
import ReactDOM from 'react-dom';
import { Table, Button, Input, Select } from 'uiw';

Expand Down Expand Up @@ -1054,6 +1055,7 @@ ReactDOM.render(<Demo />, _mount_);

<!--rehype:bgWhite=true&codeSandbox=true&codePen=true-->
```jsx
import React from 'react';
import ReactDOM from 'react-dom';
import { Table, Button, Input, Select, Form, Notify } from 'uiw';

Expand Down Expand Up @@ -1094,7 +1096,14 @@ const columns = (actived, setChange, fields) => {
<Button type="danger" onClick={()=>setChange({})}>Cancel</Button>
</>
}
return <Button type="primary" onClick={()=>setChange(rowData)} disabled={actived !== undefined && !flag}>Edit</Button>
return <Button
type="primary"
onClick={(e)=>{
e.preventDefault();
setChange(rowData)
}}
disabled={actived !== undefined && !flag}
>Edit</Button>
}
}
]
Expand Down Expand Up @@ -1148,17 +1157,11 @@ const Demo = () => {
children: <Select>
<Select.Option value=""></Select.Option>
<Select.Option value=""></Select.Option>
</Select>
</Select>
}
}}
>
{({ fields, state, canSubmit }) => {
return (
<div>
<Table columns={columns(id, setChange, fields)} data={data} />
</div>
)
}}
{({ fields }) => <Table columns={columns(id, setChange, fields)} data={data} />}
</Form>
};
ReactDOM.render(<Demo />, _mount_);
Expand Down

0 comments on commit 3a43b33

Please sign in to comment.