跳转到内容

pivotick v3.0.0


pivotick / UIComponent

抽象类: UIComponent ​

定义于:ui/UIComponent.ts:27

每个 UI 元素的基类。它提供:

  1. 一棵复合树。一个组件拥有children;四个生命周期阶段中的三个 (afterMount / graphReady / destroy) 自动递归到其中。 mount 是个例外——它需要每个子级插槽,因此 addChild 显式挂载每个子级。父级通过 addChild 声明其子级,并且其生命周期由其驱动。
  2. 一次性注册表。通过track/listen注册的任何内容(事件取消订阅、DOM侦听器、计时器)都会在destroy上拆除。

子类重写 on* 钩子而不是生命周期方法本身,因此递归和拆卸始终运行。

派生类型 ​

构造函数 ​

构造函数 ​

new UIComponent(uiManager): UIComponent

定义于:ui/UIComponent.ts:32

参数 ​

uiManager ​

UIManager

返回值 ​

UIComponent

方法 ​

afterMount() ​

afterMount(): void

定义于:ui/UIComponent.ts:54

返回值 ​

void


destroy() ​

destroy(): void

定义于:ui/UIComponent.ts:64

返回值 ​

void


graphReady() ​

graphReady(): void

定义于:ui/UIComponent.ts:59

返回值 ​

void


mount() ​

mount(container?): void

定义于:ui/UIComponent.ts:50

参数 ​

container? ​

HTMLElement

返回值 ​

void