Skip to content

Commit

Permalink
fix: the value should be judged as null or undefined when transform t…
Browse files Browse the repository at this point in the history
…he defaultValue
  • Loading branch information
penwa committed Mar 29, 2021
1 parent aaa405e commit 2fe08ad
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/nerv/src/create-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
Props,
VNode,
VirtualChildren,
EMPTY_CHILDREN
EMPTY_CHILDREN,
isNullOrUndef
} from 'nerv-shared'
import SVGPropertyConfig from './vdom/svg-property-config'
import Component from './component'
Expand All @@ -16,8 +17,8 @@ function transformPropsForRealTag (type: string, props: Props) {
const newProps: Props = {}
for (const propName in props) {
const propValue = props[propName]
if (propName === 'defaultValue') {
newProps.value = props.value || props.defaultValue
if (propName === 'defaultValue' && isNullOrUndef(props.value)) {
newProps.value = props.defaultValue
continue
}
const svgPropName = SVGPropertyConfig.DOMAttributeNames[propName]
Expand Down

0 comments on commit 2fe08ad

Please sign in to comment.