Skip to content

Commit 3a43b33

Browse files
authoredApr 2, 2022
doc(Table): 更新table组件文档 可编辑行例子的错误 (#739)
1 parent 06af728 commit 3a43b33

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed
 

‎packages/react-table/README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,7 @@ ReactDOM.render(<Demo />, _mount_);
936936

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

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

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

@@ -1094,7 +1096,14 @@ const columns = (actived, setChange, fields) => {
10941096
<Button type="danger" onClick={()=>setChange({})}>Cancel</Button>
10951097
</>
10961098
}
1097-
return <Button type="primary" onClick={()=>setChange(rowData)} disabled={actived !== undefined && !flag}>Edit</Button>
1099+
return <Button
1100+
type="primary"
1101+
onClick={(e)=>{
1102+
e.preventDefault();
1103+
setChange(rowData)
1104+
}}
1105+
disabled={actived !== undefined && !flag}
1106+
>Edit</Button>
10981107
}
10991108
}
11001109
]
@@ -1148,17 +1157,11 @@ const Demo = () => {
11481157
children: <Select>
11491158
<Select.Option value=""></Select.Option>
11501159
<Select.Option value=""></Select.Option>
1151-
</Select>
1160+
</Select>
11521161
}
11531162
}}
11541163
>
1155-
{({ fields, state, canSubmit }) => {
1156-
return (
1157-
<div>
1158-
<Table columns={columns(id, setChange, fields)} data={data} />
1159-
</div>
1160-
)
1161-
}}
1164+
{({ fields }) => <Table columns={columns(id, setChange, fields)} data={data} />}
11621165
</Form>
11631166
};
11641167
ReactDOM.render(<Demo />, _mount_);

0 commit comments

Comments
 (0)
Please sign in to comment.