// pages/index/index.js import { getUserInfo } from "../../api/user" const event = require('../../../utils/event') const app = getApp() Component({ options: { addGlobalClass: true, multipleSlots: true }, /** * 页面的初始数据 */ data: { height: app.globalData.safeFragmentHeight, tabList: [ { status: 0, badge: 2, name: '定价', icon: '/assets/image/icon_pricing.png' }, { status: 1, badge: 4, name: '过磅审核', icon: '/assets/image/icon_checking.png' }, { status: 2, badge: '', name: '代付款', icon: '/assets/image/icon_payment.png' }, { status: 3, badge: '', name: '已完成', icon: '/assets/image/icon_finish.png' }, { status: 4, badge: '', name: '已关闭', icon: '/assets/image/icon_close.png' } ] }, lifetimes: { // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached: function () { this.setData({ height: app.globalData.safeFragmentHeight - 100 }) event.on('EventMessage', this, this.onEvent) }, detached: function () { event.remove('EventMessage', this) } }, methods: { onRestart: function () { }, onEvent: function (message) { if (message.what == 888) { } }, toOrderList: function (e) { wx.navigateTo({ url: '/pages/process/order-list/index?status=' + e.currentTarget.dataset.status }) } } })