1.index.js文件
//顶部
pagechange: function (ee) {
if ("touch" === ee.detail.source) {
let currentPageIndex = this.data.currentIndex;
currentPageIndex = (currentPageIndex + 1) % 2;
this.setData({
currentIndex: currentPageIndex,
})
}
},
/点击tab时触发
next: function (e) {
console.log(e)
this.setData({
//拿到当前索引并动态改变
currentIndex: e.currentTarget.dataset.idx
})
let count = e.currentTarget.dataset.tb_year;
let year = parseInt(count.split("-")[0]);
let month = parseInt(count.split("-")[1]);
if (month == 12) {
year = year+1;
month = 1;
this.setData({
tb_year: year + '-'+ '0' + month
})
}else if(month < 9 && month >= 1) {
month=month+1;
this.setData({
tb_year: year + '-'+ '0' + m