const app = getApp(); Page({ data: { statusBarHeight: 20, current: 0, show: [1], list: [ { text: "实训" ,type:"shixun"}, { text: "课堂" , type:"course"}, //{text:"课程"} ] }, enterSearch() { let type = this.data.list[this.data.current].type || ''; app.navigateTo({ url: `{search}?type=${type}`}); }, onLoad: function (options) { wx.getSystemInfo({ success: res => { let { statusBarHeight } = res; this.setData({ statusBarHeight }); }, }) }, switchNav({ target: { dataset: { current } } }) { this.setData({ current }); this.setData({ ['show[' + current + ']']: 1 }) }, switchTab({ detail: { current, source, value } }) { console.log(current, source, value); if (source == "touch") { this.setData({ current }); this.setData({ ['show[' + current + ']']: 1 }) } }, onShareAppMessage: function () { } })