Skip to content

Commit a1c35fe

Browse files
authored
fix: fix bug for field and cell(#660) (#669)
1 parent c79c4f1 commit a1c35fe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/react-vant/src/components/cell/Cell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ const Cell: React.FC<CellProps> = props => {
3737

3838
const renderValue = () => {
3939
const hasTitle = isDef(props.title)
40-
const hasValue = props.children || isDef(props.value)
40+
const hasValue = isDef(props.children) || isDef(props.value)
4141

4242
if (hasValue) {
4343
return (
4444
<div
4545
className={clsx(bem('value', { alone: !hasTitle }), props.valueClass)}
4646
>
47-
{props.children ? props.children : <span>{props.value}</span>}
47+
{isDef(props.children) ? props.children : <span>{props.value}</span>}
4848
</div>
4949
)
5050
}

packages/react-vant/src/components/field/Field.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const Field = forwardRef<FieldInstance, FieldProps>((p, ref) => {
107107
onOverlimit,
108108
} = props
109109

110-
if (props.children) {
110+
if (isDef(props.children)) {
111111
return <div className={clsx(bem('children'))}>{props.children}</div>
112112
}
113113

0 commit comments

Comments
 (0)