const ListAdapter = require('../friendlist/ListViewAdpater'); cc.Class({ extends: cc.Component, properties: { scrollView: cc.ScrollView, content: cc.Node, tipLabel: cc.Label, item: cc.Node, itemScriptName: 'RankItem', }, onLoad() { this.listAdapter = new ListAdapter(this.scrollView); }, bindData(list) { if (list) { this.content.active = true; this.tipLabel.node.active = false; this.listAdapter.updateItems(list, this.item, this.itemScriptName); } else { this.content.active = false; this.tipLabel.node.active = true; this.tipLabel.string = "暂无数据"; } }, networkError(error) { console.log(error); this.tipLabel.node.active = true; this.tipLabel.string = '网络错误'; this.content.active = false; }, update(dt) { this.listAdapter.update(dt); }, });