Skip to content

Commit

Permalink
fix(input): placeholder 无法设置空字符串 (#2282)
Browse files Browse the repository at this point in the history
  • Loading branch information
oasis-cloud authored May 24, 2024
1 parent c89e222 commit 61a4d03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/packages/input/input.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface InputProps extends BasicComponent {
name: string
defaultValue?: string
value?: string
placeholder: string
placeholder?: string
align: InputAlign
disabled: boolean
readOnly: boolean
Expand All @@ -50,7 +50,7 @@ const defaultProps = {
...ComponentDefaults,
type: 'text',
name: '',
placeholder: '',
placeholder: undefined,
confirmType: 'done',
align: 'left',
required: false,
Expand Down Expand Up @@ -232,7 +232,9 @@ export const Input = forwardRef(
type={inputType(type) as any}
password={type === 'password'}
maxlength={maxLength}
placeholder={placeholder || locale.placeholder}
placeholder={
placeholder === undefined ? locale.placeholder : placeholder
}
disabled={disabled || readOnly}
value={value}
focus={autoFocus}
Expand Down
8 changes: 5 additions & 3 deletions src/packages/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface InputProps extends BasicComponent {
name: string
defaultValue?: string
value?: string
placeholder: string
placeholder?: string
align: InputAlign
disabled: boolean
readOnly: boolean
Expand All @@ -45,7 +45,7 @@ const defaultProps = {
...ComponentDefaults,
type: 'text',
name: '',
placeholder: '',
placeholder: undefined,
confirmType: 'done',
align: 'left',
required: false,
Expand Down Expand Up @@ -213,7 +213,9 @@ export const Input = forwardRef(
}}
type={inputType(type)}
maxLength={maxLength}
placeholder={placeholder || locale.placeholder}
placeholder={
placeholder === undefined ? locale.placeholder : placeholder
}
disabled={disabled}
readOnly={readOnly}
value={value}
Expand Down

0 comments on commit 61a4d03

Please sign in to comment.