Skip to content

Commit

Permalink
fix: fix bug for field and cell(#660) (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
LZHD authored Aug 22, 2023
1 parent c79c4f1 commit a1c35fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/react-vant/src/components/cell/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ const Cell: React.FC<CellProps> = props => {

const renderValue = () => {
const hasTitle = isDef(props.title)
const hasValue = props.children || isDef(props.value)
const hasValue = isDef(props.children) || isDef(props.value)

if (hasValue) {
return (
<div
className={clsx(bem('value', { alone: !hasTitle }), props.valueClass)}
>
{props.children ? props.children : <span>{props.value}</span>}
{isDef(props.children) ? props.children : <span>{props.value}</span>}
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-vant/src/components/field/Field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const Field = forwardRef<FieldInstance, FieldProps>((p, ref) => {
onOverlimit,
} = props

if (props.children) {
if (isDef(props.children)) {
return <div className={clsx(bem('children'))}>{props.children}</div>
}

Expand Down

0 comments on commit a1c35fe

Please sign in to comment.