mirror of
https://github.com/Leo501/CocosCreatorTutorial.git
synced 2026-05-18 12:45:39 +08:00
添加一个自定义ListView 实现, 高效复用机制以及便捷的使用接口
This commit is contained in:
24
ListViewJsDemo/assets/Script/HelloWorld.js
Normal file
24
ListViewJsDemo/assets/Script/HelloWorld.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import ListView, {AbsAdapter} from "./ListView";
|
||||
|
||||
const ListAdapter = require('./ListAdapter');
|
||||
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
listView: {
|
||||
default: null,
|
||||
type: ListView
|
||||
},
|
||||
tipLabel: {
|
||||
type: cc.Label,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
|
||||
start() {
|
||||
const adapter = new ListAdapter();
|
||||
adapter.setDataSet([1, 2, 3, 4, 5, 6, 7, 8, 89, 9, 12, 1243, 45, 564, 6756, 876, 7988, 789, 78987, 978, 45, 6732, 423, 42]);
|
||||
this.listView.setAdapter(adapter);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user