20 lines
519 B
TypeScript
20 lines
519 B
TypeScript
|
|
||
|
import { _decorator, Component, Node } from 'cc';
|
||
|
import { BaseMain } from './baseMain';
|
||
|
const { ccclass, property } = _decorator;
|
||
|
|
||
|
@ccclass('Simple')
|
||
|
export class Simple extends BaseMain {
|
||
|
|
||
|
async onLoad() {
|
||
|
for (let i = 0; i < 20; i++) {
|
||
|
this.datas.push({ message: i })
|
||
|
}
|
||
|
this.layout.total(this.datas.length)
|
||
|
// 如果你是动态修改尺寸时 需要下一帧执行滚动
|
||
|
this.scheduleOnce(() => {
|
||
|
this.layout.scrollToHeader(1)
|
||
|
})
|
||
|
}
|
||
|
}
|