12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 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(1).then( (respondData) => {
- this._shops = respondData.shops;
- /// 购买了就是一条数据
- this._tjShops = respondData.tjShops;
- /// 合辑数据
- let albumItem = cc.instantiate(this.item);
- albumItem.getComponent('StoreBigItem').initAlbum(this._tjShops);
- this.content.addChild(albumItem);
- for (let i = 0; i < this._shops.length; ++ i) {
- let recomendItem = cc.instantiate(this.item);
- recomendItem.getComponent('StoreBigItem').init(this._shops[i], 20, 1, i);
- this.content.addChild(recomendItem);
- }
- }).catch((code, msg) => {
- console.log(code, msg);
- })
- },
- start () {
- },
- // update (dt) {},
- });
|