SuperScrollView_3.X/assets/scripts/page.ts

29 lines
776 B
TypeScript
Raw Normal View History

2022-01-13 09:21:54 +00:00
import { _decorator, Component, Node } from 'cc';
import { BaseItem } from './baseItem';
import { SuperLayout } from '../core/super-layout';
import { BaseMain } from './baseMain';
const { ccclass, property } = _decorator;
@ccclass('Page')
export class Page extends BaseMain {
@property(SuperLayout) layout!: SuperLayout
start() {
for (let i = 0; i < 8; i++) {
this.datas.push({
message: i
})
}
this.layout.total(this.datas.length)
}
onRefreshEvent(item: Node, index: number) {
item.getComponent(BaseItem)?.show(this.datas[index], index, this.onClickItem.bind(this))
}
onClickItem() {
}
onPageEvent(event: any) {
console.error(this.layout.currPageIndex)
}
}