Skip to content

Commit

Permalink
chore: change type
Browse files Browse the repository at this point in the history
  • Loading branch information
yehuozhili committed Jun 27, 2020
1 parent c23d53a commit 1797b59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/components/AutoComplete/autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const AutoComplete: FC<AutoCompleteType> = (props) => {
...restProps
} = props;
const [dropdown, setDropDown] = useState<DataSourceType[]>([]);
const [state, setState] = useState(value ? value : "");
const [state, setState] = useState(value!);
const [loading, setLoading] = useState(false);
const [highlightIndex, setHighlightIndex] = useState(-1);
const debouncedValue = useDebounce(state, delay);
Expand Down Expand Up @@ -140,7 +140,7 @@ export const AutoComplete: FC<AutoCompleteType> = (props) => {
return (
<div className="bigbear-autocomplete" ref={autoRef}>
<Input
value={state}
value={state!}
{...restProps}
setValueCallback={setState}
onKeyDown={handlekeyDown}
Expand All @@ -167,7 +167,8 @@ export const AutoComplete: FC<AutoCompleteType> = (props) => {
};

AutoComplete.defaultProps = {
delay: 500
delay: 500,
value: ""
};

export default AutoComplete;
2 changes: 1 addition & 1 deletion src/components/Input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface InputProps extends InputHTMLAttributes<HTMLElement> {
/**父组件接管受控组件,父组件传value属性做state */
setValueCallback?: (v: string) => void;
/** 父组件接管状态时传递 */
value: string;
value?: string | undefined;
}

export const Input: FC<InputProps> = (props: InputProps) => {
Expand Down

0 comments on commit 1797b59

Please sign in to comment.