RankList.js 993 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. const ListAdapter = require('../friendlist/ListViewAdpater');
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. scrollView: cc.ScrollView,
  6. content: cc.Node,
  7. tipLabel: cc.Label,
  8. item: cc.Node,
  9. itemScriptName: 'RankItem',
  10. },
  11. onLoad() {
  12. this.listAdapter = new ListAdapter(this.scrollView);
  13. },
  14. bindData(list) {
  15. if (list) {
  16. this.content.active = true;
  17. this.tipLabel.node.active = false;
  18. this.listAdapter.updateItems(list, this.item, this.itemScriptName);
  19. } else {
  20. this.content.active = false;
  21. this.tipLabel.node.active = true;
  22. this.tipLabel.string = "暂无数据";
  23. }
  24. },
  25. networkError(error) {
  26. console.log(error);
  27. this.tipLabel.node.active = true;
  28. this.tipLabel.string = '网络错误';
  29. this.content.active = false;
  30. },
  31. update(dt) {
  32. this.listAdapter.update(dt);
  33. },
  34. });