updateItem(items):void{
var posY = 0;
var data: Array = [];
for(var i= 0 ;i< items.UserWareList.length;i++){
var itemList = new BagItem(items.icon,items.name,items.count);
itemList.pos(70,posY);
data.push(itemList);
posY = posY + 200;
}
let list = new Laya.List;
list.width = this.itemList.width;
list.height = this.itemList.height;
list.x = this.itemList.x;
list.y = this.itemList.y;
list.spaceY = 12;
list.vScrollBarSkin = "";
list.selectEnable = true;
list.itemRender = BagItem;
list.renderHandler = new Handler(this, this.updateListItem);
list.selectHandler = new Handler(this, this.onSelect);
this.addChild(list);
list.array = data;
}
updateListItem(cell: BagItem, index: number):void{
console.log("3333333333333");
if (cell.useBtn.clickHandler == undefined) {
cell.useBtn.on("click", this, this.onItemUse, [index]);
}
}
onItemUse(index):void{
console.log("11111111111111111");
}
onSelect():void{
console.log("22222222222222222");
}
这是我写的BagItem里面有个按钮但是 按钮不能被点击 应该是被吞噬了吧