From abf811235984c6ebfbf8c5f4b090e87cf7a6efb0 Mon Sep 17 00:00:00 2001 From: dj <1042039504@qq.com> Date: Fri, 27 Feb 2026 20:46:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(runtime):=20=E6=B7=BB=E5=8A=A0=20Fragment?= =?UTF-8?q?=20Text=20Comment=20=E5=AF=BC=E5=87=BA=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 runtime-core 中导出 Fragment、Text、Comment 符号 - 在 vue 主入口文件中导出 Fragment、Text、Comment - 添加 h-other.html 示例文件展示 Text、Comment、Fragment 的使用 - 添加 h-other-ym-test.html 示例文件测试 Fragment 渲染功能 - 创建 Fragment、Text、Comment 符号常量定义 --- packages/runtime-core/src/index.ts | 1 + packages/runtime-core/src/vnode.ts | 4 +++ ...deo-test.html => h-component-ym-test.html} | 0 .../vue/examples/runtime/h-other-ym-test.html | 27 +++++++++++++++++++ packages/vue/examples/runtime/h-other.html | 24 +++++++++++++++++ packages/vue/src/index.ts | 9 ++++++- 6 files changed, 64 insertions(+), 1 deletion(-) rename packages/vue/examples/runtime/{h-component-video-test.html => h-component-ym-test.html} (100%) create mode 100644 packages/vue/examples/runtime/h-other-ym-test.html create mode 100644 packages/vue/examples/runtime/h-other.html diff --git a/packages/runtime-core/src/index.ts b/packages/runtime-core/src/index.ts index a2fbb14..d1f3302 100644 --- a/packages/runtime-core/src/index.ts +++ b/packages/runtime-core/src/index.ts @@ -1,3 +1,4 @@ export { queuePreFlushCb } from './scheduler' export { watch } from './apiWatch' export { h } from './h' +export { Fragment, Text, Comment } from './vnode' diff --git a/packages/runtime-core/src/vnode.ts b/packages/runtime-core/src/vnode.ts index 5ce3b7d..2acd86b 100644 --- a/packages/runtime-core/src/vnode.ts +++ b/packages/runtime-core/src/vnode.ts @@ -6,6 +6,10 @@ import { ShapeFlags } from '@vue/shared' +export const Fragment = Symbol('Fragment') +export const Text = Symbol('Text') +export const Comment = Symbol('Comment') + export interface VNode { __v_isVNode: true type: any diff --git a/packages/vue/examples/runtime/h-component-video-test.html b/packages/vue/examples/runtime/h-component-ym-test.html similarity index 100% rename from packages/vue/examples/runtime/h-component-video-test.html rename to packages/vue/examples/runtime/h-component-ym-test.html diff --git a/packages/vue/examples/runtime/h-other-ym-test.html b/packages/vue/examples/runtime/h-other-ym-test.html new file mode 100644 index 0000000..b0744d7 --- /dev/null +++ b/packages/vue/examples/runtime/h-other-ym-test.html @@ -0,0 +1,27 @@ + + + + + Document + + + +
+ + + \ No newline at end of file diff --git a/packages/vue/examples/runtime/h-other.html b/packages/vue/examples/runtime/h-other.html new file mode 100644 index 0000000..512f16d --- /dev/null +++ b/packages/vue/examples/runtime/h-other.html @@ -0,0 +1,24 @@ + + + + + Document + + + +
+ + + \ No newline at end of file diff --git a/packages/vue/src/index.ts b/packages/vue/src/index.ts index e7d54e3..48d17df 100644 --- a/packages/vue/src/index.ts +++ b/packages/vue/src/index.ts @@ -1,2 +1,9 @@ export { reactive, effect, ref, computed } from '@vue/reactivity' -export { queuePreFlushCb, watch, h } from '@vue/runtime-core' +export { + queuePreFlushCb, + watch, + h, + Fragment, + Text, + Comment +} from '@vue/runtime-core'