From 7698270eb76c4cc83625ebd6607ecadaf566246c Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 24 Jun 2016 21:57:06 -0400 Subject: [PATCH] cast primitive children to string --- src/core/vdom/helpers.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/vdom/helpers.js b/src/core/vdom/helpers.js index 4e19a4b1..ec60f179 100644 --- a/src/core/vdom/helpers.js +++ b/src/core/vdom/helpers.js @@ -10,8 +10,8 @@ export function normalizeChildren (children: any): Array { if (typeof children === 'function') { children = children() } - if (typeof children === 'string') { - return [new VNode(undefined, undefined, undefined, children)] + if (isPrimitive(children)) { + return [new VNode(undefined, undefined, undefined, String(children))] } if (Array.isArray(children)) { const res = [] @@ -22,7 +22,7 @@ export function normalizeChildren (children: any): Array { res.push.apply(res, normalizeChildren(c)) } else if (isPrimitive(c)) { // convert primitive to vnode - res.push(new VNode(undefined, undefined, undefined, c)) + res.push(new VNode(undefined, undefined, undefined, String(c))) } else if (c instanceof VNode) { res.push(c) }