Skip to content

Commit

Permalink
refactor: Panel 默认展开属性重命名 & 移除在effect中使用 defaultActiveKey
Browse files Browse the repository at this point in the history
  • Loading branch information
lihongxiangfrontend committed Nov 26, 2024
1 parent 8f75363 commit 8895a35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
10 changes: 1 addition & 9 deletions examples/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export default () => {
const [value2, setValue2] = React.useState<string[][]>([]);

const [disabled, setDisabled] = React.useState(false);
const [defaultActiveValueCells, setDefaultActiveValueCells] = React.useState<string[]>([]);

return (
<>
Expand Down Expand Up @@ -91,13 +90,6 @@ export default () => {
disabled={disabled}
/>

<button
onClick={() => {
setDefaultActiveValueCells(['bj', 'haidian']);
}}
>
Set defaultActiveValueCells
</button>
<Cascader.Panel
checkable
value={value2}
Expand All @@ -107,7 +99,7 @@ export default () => {
setValue2(nextValue);
}}
disabled={disabled}
defaultActiveValueCells={defaultActiveValueCells}
defaultActiveKey={['bj', 'haidian']}
/>

<Cascader.Panel options={addressOptions} disabled={disabled} direction="rtl" />
Expand Down
4 changes: 2 additions & 2 deletions src/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export type PickType =
| 'direction'
| 'notFoundContent'
| 'disabled'
| 'defaultActiveValueCells';
| 'defaultActiveKey';

export type PanelProps<
OptionType extends DefaultOptionType = DefaultOptionType,
Expand Down Expand Up @@ -205,7 +205,7 @@ export default function Panel<
open
direction={direction}
disabled={disabled}
defaultActiveValueCells={defaultActiveValueCells}
defaultActiveKey={defaultActiveKey}
/>
)}
</div>
Expand Down

0 comments on commit 8895a35

Please sign in to comment.