feat(runtime): 添加 h 函数和虚拟节点系统
- 实现了 h 函数用于创建虚拟节点 - 添加了 VNode 接口定义和创建逻辑 - 引入了 ShapeFlags 枚举来标记节点类型 - 实现了虚拟节点子元素标准化功能 - 在 runtime-core 中导出 h 函数 - 添加了 h 函数使用示例页面
This commit is contained in:
18
packages/vue/examples/runtime/h-element.html
Normal file
18
packages/vue/examples/runtime/h-element.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Document</title>
|
||||
<script src="../../dist/vue.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script>
|
||||
const {h} =Vue
|
||||
const vnode=h('div',{
|
||||
class:'test'
|
||||
},'hello render')
|
||||
console.log(vnode)
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user