// app.ts App({ globalData: { env: 'release', printConfig: { header: 'wechat', appName: '涂鸦丫小程序' } }, onLaunch() { const accountInfo = wx.getAccountInfoSync(); const env = accountInfo.miniProgram.envVersion || 'release'; this.globalData.env = env; if (env !== 'release') { const printConfig = wx.getStorageSync('printConfig') || { header: 'wechat', appName: '涂鸦丫小程序' }; this.globalData.printConfig = printConfig; } }, onShow() { // 小程序显示时的生命周期 }, onHide() { // 小程序隐藏时的生命周期 }, getPrintConfig(): PrintConfig { return this.globalData.printConfig || { header: 'wechat', appName: '涂鸦丫小程序' }; }, setPrintConfig(config: PrintConfig) { this.globalData.printConfig = config; wx.setStorageSync('printConfig', config); } });