Skip to content

Commit

Permalink
fix(list-picker): clear error (#1602)
Browse files Browse the repository at this point in the history
  • Loading branch information
berber1016 committed Dec 3, 2021
1 parent 50158a0 commit 903517e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/cascader/Cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const Cascader: React.FC<CascaderProps> = ({

const handleOnClear = (e: React.MouseEvent<Element, MouseEvent>) => {
onClear?.();
onChange?.();
handVisibleChange(false);
e.stopPropagation();
};
Expand Down
2 changes: 1 addition & 1 deletion src/list-picker/demos/List-picker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const Template: Story<ListPickerProps> = () => {
overlayStyle={{ width: '240px' }}
style={{ width: '100%' }}
onClear={() => {
setValue('');
console.log('onClear执行');
}}
allowClear
placeholder="请选择"
Expand Down
3 changes: 2 additions & 1 deletion src/list-picker/listPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ListPicker: React.FC<ListPickerProps> = (props) => {
placement = 'bottomLeft',
children,
onConfim,
confimText = localeTextObject.confirm,
confimText = localeTextObject?.confirm,
separator = '',
style,
overlayStyle,
Expand Down Expand Up @@ -92,6 +92,7 @@ const ListPicker: React.FC<ListPickerProps> = (props) => {
const clearInput = () => {
setValue(undefined);
onClear?.();
onChange?.();
};
const triggerClick = () => !disabled && setVisible(!visible);
// trigger
Expand Down
1 change: 1 addition & 0 deletions src/select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const Select: React.FC<SelectProps> & { isSelect?: boolean } = (props) => {

const handleOnClear = (e: React.MouseEvent<Element, MouseEvent>) => {
onClear?.();
onChange?.();
handVisibleChange(false);
e.stopPropagation();
};
Expand Down

1 comment on commit 903517e

@vercel
Copy link

@vercel vercel bot commented on 903517e Dec 3, 2021

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.