要在scrollview中动态生成所需的道具。添加点击事件,选中该道具。在cocos2D中能实现。3D中点击没效果。 代码如下
这是scrollview中添加的prefab关联的ts代码:
init(rank, itemInfo) {
var that = this;
that.jianName.getComponent(cc.LabelComponent).string = itemInfo.propName;
this.node._data = itemInfo.appNo;
this.node.on('click',function(){
console.log(123312);
})
}
this.node.on('click',function(){}未触发执行.
请问:怎么实现子item的点击触发事件?
