Skip to content
On this page

Class: Container

显示对象组件

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Container()

组件不能单独实例化,必须通过Transform.addComponent创建

ts
const node = new Transform();
const componet = node.addComponent(Component);

Inherited from

DisplayObjects.constructor

Defined in

src/core/component/Component.ts:37

Properties

emitter

emitter: EventEmitter<string | symbol, any>

事件处理器

Inherited from

DisplayObjects.emitter

Defined in

src/core/component/Component.ts:27


id

id: number

用于表示组件的唯一标识

Inherited from

DisplayObjects.id

Defined in

src/core/component/Component.ts:12


name

name: string = ''

组件名

Inherited from

DisplayObjects.name

Defined in

src/core/component/Component.ts:17


node

node: Transform<Container>

组件挂载节点

Inherited from

DisplayObjects.node

Defined in

src/core/component/Component.ts:22

Methods

destroy

destroy(): void

消毁

Returns

void

Inherited from

DisplayObjects.destroy

Defined in

src/core/component/Component.ts:55


onDestroy

Optional onDestroy(): void

组件被销毁时触发

Returns

void

Inherited from

DisplayObjects.onDestroy

Defined in

src/core/component/Component.ts:62


start

Optional start(): void

组件被挂载到节点时触发

Returns

void

Inherited from

DisplayObjects.start

Defined in

src/core/component/Component.ts:44


update

Optional update(time): void

每帧调用

Parameters

NameTypeDescription
timenumber和上一帧的间隔时间 ms

Returns

void

Inherited from

DisplayObjects.update

Defined in

src/core/component/Component.ts:50