guoqing.zhu 9fdc962809 update
2022-06-14 11:32:52 +08:00

31 lines
678 B
TypeScript

const { ccclass, property } = cc._decorator;
@ccclass
export class UIShop extends cc.Component {
@property(cc.Node) itemContentNd: cc.Node = null;
@property(cc.Prefab) itemPrefab: cc.Prefab = null;
private shopItems: any;
init(data) {
console.log(JSON.stringify(data));
this.shopItems = data.info.goods_list1;
this.reSetUI();
}
reSetUI() {
for (let i = 0; i < this.shopItems.length; i += 1) {
let singleData = this.shopItems[i];
let node = cc.instantiate(this.itemPrefab);
node.getComponent('ShopItem').init(singleData);
this.itemContentNd.addChild(node);
}
}
start() {}
onclose() {
this.node.destroy();
}
}