From 61edc322f23c2260c5a359ab909af90e81a3811b Mon Sep 17 00:00:00 2001 From: dj Date: Fri, 27 Feb 2026 17:35:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(runtime):=20=E6=B7=BB=E5=8A=A0H=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E4=BB=B6=E7=A4=BA=E4=BE=8B=E5=92=8C=E6=95=B0?= =?UTF-8?q?=E7=BB=84=E5=AD=90=E8=8A=82=E7=82=B9=E6=A0=87=E8=AE=B0=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增h-component.html示例文件展示直接创建虚拟DOM节点 - 在vnode.ts中为数组子节点添加ShapeFlags.ARRAY_CHILDREN标记 - 实现了绕过h函数直接构建组件虚拟节点的演示功能 --- packages/runtime-core/src/vnode.ts | 1 + .../vue/examples/runtime/h-component.html | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 packages/vue/examples/runtime/h-component.html diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index 4c5865a..b007dfb 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -32,6 +32,7 @@ export function normalizeChildren(vnode: VNode, children: unknown) { if (children == null) { children = null } else if (isArray(children)) { + type = ShapeFlags.ARRAY_CHILDREN } else if (typeof children === 'object') { } else if (isFunction(children)) { } else { diff --git a/packages/vue/examples/runtime/h-component.html b/packages/vue/examples/runtime/h-component.html new file mode 100644 index 0000000..f3de7f0 --- /dev/null +++ b/packages/vue/examples/runtime/h-component.html @@ -0,0 +1,38 @@ + + + + + Document + + + +
+ + + \ No newline at end of file