Files
doodle-mini/miniprogram/app.ts
T
2025-07-16 18:31:55 +08:00

43 lines
1.1 KiB
TypeScript

// app.ts
App<IAppOption>({
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);
}
});