cc.Class({ extends: cc.Component, properties: { item: cc.Prefab, content: cc.Node }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, init(content) { if (this._shops != undefined) { return; } this._shops = {}; content.getShopsByType(4).then( (respondData) => { this._shops = respondData.shops; for (let i = 0; i < this._shops.length; ++ i) { let recomendItem = cc.instantiate(this.item); recomendItem.getComponent('StoreBigItem').init(this._shops[i], 18, 4, i); this.content.addChild(recomendItem); } }).catch((code, msg) => { console.log(code, msg); }) }, start () { }, // update (dt) {}, });