// compontents/tarbar/tarbar.js const util = require('../../utils/util.js'); Component({ /** * 组件的属性列表 * 排名nav */ properties: { }, /** * 组件的初始数据 * navBtnSelectIdx点击改变的值 */ data: { motto: ['好友数','勋章数','等级','答题量','准确率'], navBtnSelectIdx: 0, }, /** * 组件的方法列表 */ methods: { navItemTap: function (e) { //更改navBtnSelectIdx加class let index = e.target.dataset.index; if (index != this.navBtnSelectIdx) { this.setData({ navBtnSelectIdx: index}); } if(index == 0) { wx.redirectTo({ url: '../competition/competition?ind=0' }) } if(index == 1) { wx.redirectTo({ url: '../medal_rank/medal_rank?ind=1' }) } if(index == 2) { wx.redirectTo({ url: '../grade_rank/grade_rank?ind=2' }) } if(index == 3) { wx.redirectTo({ url: '../quantity_rank/quantity_rank?ind=3' }) } if(index == 4) { wx.redirectTo({ url: '../accuracy_rank/accuracy_rank?ind=4' }) } } }, ready() { let options = util.getUrl(); console.log(options) if(options.ind) { this.setData({ navBtnSelectIdx: options.ind}); } } })