2021-12-17 19:46:34 +08:00

33 lines
718 B
TypeScript

const {ccclass, property} = cc._decorator;
@ccclass
export default class Page3 extends cc.Component {
@property({ type: cc.PageView })
pageView: cc.PageView = null
start () {
}
toLeft() {
if (this.pageView.isScrolling()) {
return
}
let current = this.pageView.getCurrentPageIndex()
if (current <= 0) {
return
}
this.pageView.scrollToPage(current - 1, 1)
}
toRight() {
if (this.pageView.isScrolling()) {
return
}
let current = this.pageView.getCurrentPageIndex()
if (current >= 2) {
return
}
this.pageView.scrollToPage(current + 1, 1)
}
}