GameFriendScrollView.js 750 B

123456789101112131415161718192021222324252627282930313233343536
  1. const ListViewAdapter = require('../utils/TapTapScrollViewAdapter');
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. content: cc.Node,
  6. item: cc.Prefab,
  7. },
  8. // LIFE-CYCLE CALLBACKS:
  9. // onLoad () {},
  10. start () {
  11. },
  12. init() {
  13. if (this.listAdapter === undefined || this.listAdapter === null) {
  14. this.listAdapter = new ListViewAdapter(this);
  15. this.listAdapter.spacing = 14;
  16. }
  17. let data = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16];
  18. this.listAdapter.updateItems(data, this.item, 'GameFriendItem');
  19. },
  20. onScroll() {
  21. if (this.listAdapter != undefined) {
  22. this.listAdapter.update();
  23. }
  24. },
  25. // update (dt) {},
  26. });