Skip to content

Commit 7698270

Browse files
committed
cast primitive children to string
1 parent 7304385 commit 7698270

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/core/vdom/helpers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export function normalizeChildren (children: any): Array<VNode> {
1010
if (typeof children === 'function') {
1111
children = children()
1212
}
13-
if (typeof children === 'string') {
14-
return [new VNode(undefined, undefined, undefined, children)]
13+
if (isPrimitive(children)) {
14+
return [new VNode(undefined, undefined, undefined, String(children))]
1515
}
1616
if (Array.isArray(children)) {
1717
const res = []
@@ -22,7 +22,7 @@ export function normalizeChildren (children: any): Array<VNode> {
2222
res.push.apply(res, normalizeChildren(c))
2323
} else if (isPrimitive(c)) {
2424
// convert primitive to vnode
25-
res.push(new VNode(undefined, undefined, undefined, c))
25+
res.push(new VNode(undefined, undefined, undefined, String(c)))
2626
} else if (c instanceof VNode) {
2727
res.push(c)
2828
}

0 commit comments

Comments
 (0)