diff --git a/src/select-input/useSingle.tsx b/src/select-input/useSingle.tsx index 3ffd548ab..acd5220e7 100644 --- a/src/select-input/useSingle.tsx +++ b/src/select-input/useSingle.tsx @@ -77,7 +77,7 @@ export default function useSingle(props: TdSelectInputProps) { {...commonInputProps} autoWidth={props.autoWidth} placeholder={singleValueDisplay ? '' : props.placeholder} - value={singleValueDisplay ? undefined : displayedValue} + value={singleValueDisplay ? ' ' : displayedValue} label={ <> {props.label} diff --git a/src/select/_example/custom-selected.jsx b/src/select/_example/custom-selected.jsx index 59a069629..cf3caf88f 100644 --- a/src/select/_example/custom-selected.jsx +++ b/src/select/_example/custom-selected.jsx @@ -24,7 +24,7 @@ const CustomSelected = () => { clearable defaultValue={'1'} style={{ width: '300px', marginRight: '20px' }} - valueDisplay={({ value }) => `选中${value}`} + valueDisplay={({ value }) => (value ? `选中${value}` : null)} > {options.map((v, i) => ( diff --git a/test/snap/__snapshots__/csr.test.jsx.snap b/test/snap/__snapshots__/csr.test.jsx.snap index b92811271..5e1bc9ae5 100644 --- a/test/snap/__snapshots__/csr.test.jsx.snap +++ b/test/snap/__snapshots__/csr.test.jsx.snap @@ -68646,6 +68646,7 @@ exports[`csr snapshot test > csr test src/date-picker/_example/panel.jsx 1`] = ` >
csr test src/date-picker/_example/panel.jsx 1`] = ` placeholder="" readonly="" type="text" - value="" + value=" " /> csr test src/date-picker/_example/panel.jsx 1`] = ` >
csr test src/date-picker/_example/panel.jsx 1`] = ` placeholder="" readonly="" type="text" - value="" + value=" " /> csr test src/select/_example/custom-selected.jsx 1` >
csr test src/select/_example/custom-selected.jsx 1` placeholder="" readonly="" type="text" - value="" + value=" " /> csr test src/select/_example/custom-selected.jsx 1` >
csr test src/select/_example/custom-selected.jsx 1` placeholder="" readonly="" type="text" - value="" + value=" " /> csr test src/select-input/_example/custom-tag.jsx 1 >
csr test src/select-input/_example/custom-tag.jsx 1 placeholder="" readonly="" type="text" - value="" + value=" " />
@@ -162983,6 +162988,7 @@ exports[`csr snapshot test > csr test src/select-input/_example/custom-tag.jsx 1 >
csr test src/select-input/_example/custom-tag.jsx 1 placeholder="" readonly="" type="text" - value="" + value=" " />
@@ -261155,6 +261161,7 @@ exports[`csr snapshot test > csr test src/tree-select/_example/valuedisplay.jsx >
csr test src/tree-select/_example/valuedisplay.jsx placeholder="" readonly="" type="text" - value="" + value=" " /> csr test src/tree-select/_example/valuedisplay.jsx >
csr test src/tree-select/_example/valuedisplay.jsx placeholder="" readonly="" type="text" - value="" + value=" " />