// pages/department/department.js Page({ /** * 页面的初始数据 */ data: { curNav:1, curIndex:0, scrollTop:0, }, changeTab:function(e){ let id = e.target.dataset.id, index = parseInt(e.target.dataset.index); // 把点击到的某一项,设为当前index this.setData({ curNav: id, curIndex: index, }) }, toDetail:function(e){ console.log(e) const id = e.target.id; const title = e.target.dataset.title; wx.navigateTo({ url: '../register/register?id='+id+'&title='+title, success: function(res) { console.log(111) }, fail:function(res){ console.log(res) } }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(options) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })