]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(core): use String to convert primitive types (#518)
authormeteorlxy <meteor.lxy@foxmail.com>
Wed, 4 Dec 2019 17:28:52 +0000 (01:28 +0800)
committerEvan You <yyx990803@gmail.com>
Wed, 4 Dec 2019 17:28:52 +0000 (18:28 +0100)
packages/runtime-core/src/vnode.ts

index d09040b965ab125ceac84f81678ed3336ff193e6..d47bf78c8ceccd8c2aead1250ffd871a4ac82216 100644 (file)
@@ -336,7 +336,7 @@ export function normalizeVNode<T, U>(child: VNodeChild<T, U>): VNode<T, U> {
     return child.el === null ? child : cloneVNode(child)
   } else {
     // 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 }
     type = ShapeFlags.SLOTS_CHILDREN
   } else {
-    children = isString(children) ? children : children + ''
+    children = String(children)
     type = ShapeFlags.TEXT_CHILDREN
   }
   vnode.children = children as NormalizedChildren