Skip to content

Commit aa06cc7

Browse files
authored
feat(input): 增加 taro components 属性的支持 (#3181)
* feat(input): 增加 taro components 属性的支持 * fix: 类型继承 * fix: 类型继承
1 parent f8913fb commit aa06cc7

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/packages/input/input.taro.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const Input = forwardRef((props: Partial<TaroInputProps>, ref) => {
3939
const rtl = useRtl()
4040
const { locale } = useConfig()
4141
const {
42+
focus,
4243
type,
4344
name,
4445
placeholder,
@@ -183,7 +184,7 @@ export const Input = forwardRef((props: Partial<TaroInputProps>, ref) => {
183184
placeholderClass={`${classPrefix}-placeholder`}
184185
disabled={disabled || readOnly}
185186
value={value}
186-
focus={autoFocus}
187+
focus={autoFocus || focus}
187188
confirmType={confirmType}
188189
onBlur={handleBlur}
189190
onFocus={handleFocus}

src/types/spec/input/taro.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ type OmittedInput = Omit<
99
'type' | 'ref' | 'onBlur' | 'onFocus' | 'maxlength' | 'password'
1010
>
1111

12-
export interface TaroInputProps
13-
extends Omit<
14-
BaseInput<TaroInputType, TaroInputConfirmType>,
15-
'onClick' | 'onFocus'
16-
> {
12+
type TaroInput = Omit<
13+
BaseInput<TaroInputType, TaroInputConfirmType>,
14+
'onClick' | 'onFocus'
15+
> &
16+
OmittedInput
17+
18+
export interface TaroInputProps extends TaroInput {
1719
onClick?: (e: ITouchEvent) => void
1820
onFocus?: (value: string, height?: number) => void
1921
}

0 commit comments

Comments
 (0)