// app.js import { imgAssets } from './net/http' App({ globalData: { imgAssetsUrl: imgAssets, localAssets: "/static/images" }, onLaunch() { //自定义字体 // wx.loadFontFace({ // family: 'PingFang-regular', // global: true, // source: 'https://www.aimzhu.com/miniapp-assets/PingFangSC-Regular.ttf', // success(res) { // console.log('字体加载成功') // }, // fail(err) { // console.log('字体加载错误') // } // }) // 全局事件对象 // this.eventBus = {} // // 监听事件 // this.on = function (eventName, callback) { // if (!this.eventBus[eventName]) { // this.eventBus[eventName] = [] // } // this.eventBus[eventName].push(callback) // } // // 触发事件 // this.emit = function (eventName, data) { // const callbacks = this.eventBus[eventName] // if (callbacks) { // callbacks.forEach(callback => { // callback(data) // }) // } // } } })