Skip to content

Commit

Permalink
fix(SelectInput): 修复没有label都会渲染 t-input__prefix (#3278)
Browse files Browse the repository at this point in the history
* fix(SelectInput): 修复label永远不为空的问题

* test(pagination): update snap

* test: update snap
  • Loading branch information
huangchen1031 authored Dec 12, 2024
1 parent c7d1b60 commit 322b252
Show file tree
Hide file tree
Showing 4 changed files with 400 additions and 935 deletions.
10 changes: 6 additions & 4 deletions src/select-input/useSingle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ export default function useSingle(props: TdSelectInputProps) {
placeholder={singleValueDisplay ? '' : props.placeholder}
value={singleValueDisplay ? ' ' : displayedValue}
label={
<>
{props.label}
{singleValueDisplay}
</>
(props.label || singleValueDisplay) && (
<>
{props.label}
{singleValueDisplay}
</>
)
}
onChange={onInnerInputChange}
readonly={!props.allowInput}
Expand Down
5 changes: 1 addition & 4 deletions src/table/__tests__/__snapshots__/pagination.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,8 @@ exports[`BaseTable Pagination > locale data pagination controlled > pagination.c
value="5 条/页"
>
<div
class="t-input t-is-readonly t-align-left t-input--prefix t-input--suffix"
class="t-input t-is-readonly t-align-left t-input--suffix"
>
<div
class="t-input__prefix"
/>
<input
class="t-input__inner"
placeholder="请选择"
Expand Down
Loading

0 comments on commit 322b252

Please sign in to comment.