private showBPMap(map: Map<number, Prop>, scrollView: ScrollView) {
scrollView.content.removeAllChildren();
map.forEach(prop => {
let propNode = instantiate(this.propPrefab);
propNode.name="道具"+prop.name;
propNode.getChildByName("bg").getComponent(Sprite).color = Color.RED;
// 添加点击事件
propNode.on('click', this.showPropInfo, this);
propNode.parent = scrollView.content;
})
}
public showPropInfo(node: Node) {
console.log(" click... node.name=" + node.name);
}
当点击列表中的道具节点的时候,并没有触发点击事件… 请问是因为什么原因呢?
