fix(core): use String to convert primitive types (#518)
This commit is contained in:
parent
42cdf8c409
commit
f3007a6b4f
@ -336,7 +336,7 @@ export function normalizeVNode<T, U>(child: VNodeChild<T, U>): VNode<T, U> {
|
|||||||
return child.el === null ? child : cloneVNode(child)
|
return child.el === null ? child : cloneVNode(child)
|
||||||
} else {
|
} else {
|
||||||
// primitive types
|
// primitive types
|
||||||
return createVNode(Text, null, child + '')
|
return createVNode(Text, null, String(child))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,7 +352,7 @@ export function normalizeChildren(vnode: VNode, children: unknown) {
|
|||||||
children = { default: children }
|
children = { default: children }
|
||||||
type = ShapeFlags.SLOTS_CHILDREN
|
type = ShapeFlags.SLOTS_CHILDREN
|
||||||
} else {
|
} else {
|
||||||
children = isString(children) ? children : children + ''
|
children = String(children)
|
||||||
type = ShapeFlags.TEXT_CHILDREN
|
type = ShapeFlags.TEXT_CHILDREN
|
||||||
}
|
}
|
||||||
vnode.children = children as NormalizedChildren
|
vnode.children = children as NormalizedChildren
|
||||||
|
Loading…
x
Reference in New Issue
Block a user