定义
创建虚拟 DOM 节点 (vnode)。
类型
ts
// 完整参数签名
function h(
type: string | Component, //可以创建原生dom,也可以创建组件
props?: object | null, // 可以给组件(原生dom)插入文字,添加事件等
children?: Children | Slot | Slots
): VNode;
// 省略 props
function h(type: string | Component, children?: Children | Slot): VNode;
type Children = string | number | boolean | VNode | null | Children[];
type Slot = () => Children;
type Slots = { [name: string]: Slot };
// 完整参数签名
function h(
type: string | Component, //可以创建原生dom,也可以创建组件
props?: object | null, // 可以给组件(原生dom)插入文字,添加事件等
children?: Children | Slot | Slots
): VNode;
// 省略 props
function h(type: string | Component, children?: Children | Slot): VNode;
type Children = string | number | boolean | VNode | null | Children[];
type Slot = () => Children;
type Slots = { [name: string]: Slot };