cc.Class({ extends: cc.Component, properties: { pView: cc.PageView, LeftBtn: cc.Node, RightBtn: cc.Node }, start: function () { this.PageIndex = this.pView.getCurrentPageIndex(); console.log("idx" + this.PageIndex); }, onUpdataPageView: function () { console.log("pageView"); this.PageIndex = this.pView.getCurrentPageIndex(); console.log("idx" + this.PageIndex); cc.global.PageViewIndex = this.PageIndex; }, oonBtnClickEvent: function (e) { switch (e.target.name) { case "leftBtn": var o = this.PageIndex; if (0 == this.PageIndex) { this.pView.scrollToPage(2); } else { var t = o -= 1; console.log("id" + t); this.pView.scrollToPage(t); } break; case "rightBtn": console.log("111111111111"); var i = this.PageIndex; if (2 == this.PageIndex) { this.pView.scrollToPage(0); } else { var n = i += 1; console.log("id" + n); this.pView.scrollToPage(n); } } } });