mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 20:19:44 +08:00
parent
73f4b9bcd7
commit
507fdc44ae
@ -30,16 +30,16 @@ const OperationsSlot = {
|
||||
const options = ['left', 'right'];
|
||||
|
||||
const Demo = () => {
|
||||
const [positon, setPosition] = React.useState(['left', 'right']);
|
||||
const [position, setPosition] = React.useState(['left', 'right']);
|
||||
|
||||
const slot = React.useMemo(() => {
|
||||
if (positon.length === 0) return null;
|
||||
if (position.length === 0) return null;
|
||||
|
||||
return positon.reduce(
|
||||
(acc, direaction) => ({ ...acc, [direaction]: OperationsSlot[direaction] }),
|
||||
return position.reduce(
|
||||
(acc, direction) => ({ ...acc, [direction]: OperationsSlot[direction] }),
|
||||
{},
|
||||
);
|
||||
}, [positon]);
|
||||
}, [position]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -61,7 +61,7 @@ const Demo = () => {
|
||||
<Divider />
|
||||
<CheckboxGroup
|
||||
options={options}
|
||||
value={positon}
|
||||
value={position}
|
||||
onChange={value => {
|
||||
setPosition(value);
|
||||
}}
|
||||
|
Loading…
Reference in New Issue
Block a user