SuperScrollView_3.X/assets/scripts/simple.ts

20 lines
519 B
TypeScript
Raw Permalink Normal View History

2022-01-13 09:21:54 +00:00
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)
})
}
}