Skip to content

点击button时如何拿到button对应的entity? #2567

@alonprince

Description

@alonprince

button点击时如何获取到点的是哪个button?

bindCardEvent() {
    this.cardGroupEntity.children.forEach((card) => {
      card.getComponent(Button)?.addClicked(this.onCardBtnClick);
    });
  }
private onCardBtnClick(e) {
  console.log(this, e);
}

打印了一下this和e,好像没办法直接用
Image

Metadata

Metadata

Labels

questionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions