// pages/message/message.js const $api = require('../../utils/api').API; Page({ /** * 页面的初始数据 */ data: { tabList: [{ id: 1, name: '土地供应' }, { id: 2, name: '土地成交' }, { id: 3, name: '系统消息' }], dataList:[], active: 1, page:{ current:1, size:100000, messageType:1 } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { $api.getMessage(this.data.page).then(res=>{ this.setData({ dataList:res.data.records }) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { }, tabDowm(e) { let active = Number(e.currentTarget.dataset.id) if (active !== this.data.active) { this.setData({ active, 'page.messageType':active }) $api.getMessage(this.data.page).then(res=>{ this.setData({ dataList:res.data.records }) }) } }, })