Skip to content

Commit 00db80a

Browse files
committed
feat: 优化代码
1 parent ed529d1 commit 00db80a

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

src/PickerInput/Selector/Input.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,7 @@ const Input = React.forwardRef<InputRef, InputProps>((props, ref) => {
9898
React.useImperativeHandle(ref, () => ({
9999
nativeElement: holderRef.current,
100100
inputElement: inputRef.current,
101-
focus: (options) => {
102-
if (typeof options === 'object') {
103-
const { index, ...rest } = options;
104-
inputRef.current.focus(rest);
105-
} else {
106-
inputRef.current.focus();
107-
}
108-
},
101+
focus: inputRef.current.focus,
109102
blur: () => {
110103
inputRef.current.blur();
111104
},

src/PickerInput/Selector/SingleSelector/index.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,7 @@ function SingleSelector<DateType extends object = any>(
116116

117117
React.useImperativeHandle(ref, () => ({
118118
nativeElement: rootRef.current,
119-
focus: (options) => {
120-
if (typeof options === 'object') {
121-
const { index, ...rest } = options;
122-
inputRef.current.focus(rest);
123-
} else {
124-
inputRef.current.focus();
125-
}
126-
},
119+
focus: inputRef.current.focus,
127120
blur: () => {
128121
inputRef.current?.blur();
129122
},

0 commit comments

Comments
 (0)