Skip to content

Commit

Permalink
fix(SearchTree): 通过清除按钮删除内容后,没有重置搜索选项 #563 (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
nullptr-z committed Mar 1, 2022
1 parent ef2e02b commit 463b37d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/react-search-tree/src/SearchTagInput.tsx
Expand Up @@ -81,8 +81,7 @@ function SearchTagInput<V extends SearchTagInputOption>(props: SearchTagInputPro
handleSelectChange([...selectedOption], curreentItem, false);
};

function handleInputChange(e: React.ChangeEvent<HTMLInputElement>) {
const value = e.target.value;
function handleInputChange(value: string) {
searchValueSet(value);
onSearch?.(value);
setSelectIconType(value ? 'loading' : '');
Expand All @@ -92,8 +91,7 @@ function SearchTagInput<V extends SearchTagInputOption>(props: SearchTagInputPro
function resetSelectedValue() {
// setInnerIsOpen(false);
setSelectedOption([]);
searchValueSet('');
setSelectIconType('');
handleInputChange('');
handleSelectChange([]);
}

Expand Down Expand Up @@ -147,7 +145,7 @@ function SearchTagInput<V extends SearchTagInputOption>(props: SearchTagInputPro
size={size}
disabled={disabled}
onKeyDown={inputKeyDown}
onChange={handleInputChange}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => handleInputChange(e.target.value)}
value={searchValue}
placeholder={selectedOption.length ? '' : placeholder}
// readOnly={false}
Expand Down

0 comments on commit 463b37d

Please sign in to comment.