类 MComponent
渲染进程类,游戏进程不能直接使用。对于部分方法,请参考 UI 编写
- 实例成员
- 实例方法
- 静态成员
- 静态方法
content
ts
declare var content: any[]成员说明
存储了当前组件的所有内容
defineProps()
ts
declare function defineProps(props: Record<string, any>): thisdefineEmits()
ts
declare function defineEmits(emits: string[]): thisdiv()
ts
declare function div(children?: any, config?: any): thisspan()
ts
declare function span(children?: any, config?: any): thiscanvas()
ts
declare function canvas(config?: any): thistext()
ts
declare function text(text: string | (() => string), config?: any): thiscom()
ts
declare function com(component: any, config?: any): thisvfor()
ts
declare function vfor(items: any, map: (value: any, index: number) => VNode): thish()
ts
declare function h(type: any, children?: any, config?: any): thisonSetup()
ts
declare function onSetup(fn: OnSetupFunction): thisonMounted()
ts
declare function onMounted(fn: OnMountedFunction): thissetup()
ts
declare function setup(fn: SetupFunction): thisret()
ts
declare function ret(fn: RetFunction): thisexport()
ts
declare function export(): ComponentmountNum
ts
declare var mountNum: numbervNodeS()
ts
declare function vNodeS(child: any, mount?: number): VNode静态方法说明
将单个渲染内容输出为单个
VNode
vNodeM()
ts
declare function vNodeM(mc: MComponent, mount?: number): VNode[]静态方法说明
将一个
MComponent组件渲染为一个VNode数组
vNode()
ts
declare function vNode(children: any, mount?: number): VNode[]静态方法说明
将一系列渲染内容输出为一个
VNode数组
unwrapProps()
ts
declare function unwrapProps(props?: Record<string, () => any>): Record<string, any>静态方法说明
获取 props 的真实值。因为传入渲染内容的 props 是一个函数,因此需要一层调用
prop()
ts
declare function prop(component: Component, props: Record<string, any>): VNode静态方法说明
在渲染时给一个组件传递 props。实际效果为在调用后并不会传递,当被传递的组件被渲染时,将会传递 props。