2021-12-20 11:21:53 +08:00

35 lines
738 B
TypeScript

import Page from '../Page'
const {ccclass, property} = cc._decorator;
@ccclass
export default class Page3 extends Page {
@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)
}
}