33 lines
718 B
TypeScript
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)
|
|
}
|
|
}
|