Skip to content

Commit 77ba15b

Browse files
committed
fix: 删除无用代码
1 parent 94d1c43 commit 77ba15b

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/packages/searchbar/searchbar.taro.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ export const SearchBar: FunctionComponent<
7575
finalValue: '',
7676
})
7777

78-
useEffect(() => {
79-
setValue(defaultValue)
80-
}, [defaultValue])
81-
8278
const forceFocus = () => {
8379
const searchSelf: HTMLInputElement | null = searchInputRef.current
8480
searchSelf && searchSelf.focus()
@@ -137,7 +133,7 @@ export const SearchBar: FunctionComponent<
137133
<View
138134
key={`def-${index}`}
139135
className="nut-searchbar-value"
140-
onClick={() => onItemClick(item)}
136+
onClick={() => onItemClick?.(item)}
141137
>
142138
{item}
143139
<Close />

src/packages/searchbar/searchbar.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ export const SearchBar: FunctionComponent<
6868
finalValue: '',
6969
})
7070

71-
useEffect(() => {
72-
setValue(defaultValue)
73-
}, [defaultValue])
74-
7571
const forceFocus = () => {
7672
const searchSelf: HTMLInputElement | null = searchInputRef.current
7773
searchSelf && searchSelf.focus()
@@ -125,7 +121,7 @@ export const SearchBar: FunctionComponent<
125121
<div
126122
key={`def-${index}`}
127123
className="nut-searchbar-value"
128-
onClick={() => onItemClick(item)}
124+
onClick={() => onItemClick?.(item)}
129125
>
130126
{item}
131127
<Close />

0 commit comments

Comments
 (0)