feat:优化 debug 页

This commit is contained in:
2025-07-16 18:31:55 +08:00
parent 72be2372ee
commit 3ce3d3cac4
15 changed files with 177 additions and 60 deletions
+18 -9
View File
@@ -1,15 +1,22 @@
// app.ts
App<IAppOption>({
globalData: {
env: 'release'
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 printHeader = wx.getStorageSync('printHeader') || 'wechat';
this.globalData.printHeader = printHeader;
const printConfig = wx.getStorageSync('printConfig') || {
header: 'wechat',
appName: '涂鸦丫小程序'
};
this.globalData.printConfig = printConfig;
}
},
@@ -21,13 +28,15 @@ App<IAppOption>({
// 小程序隐藏时的生命周期
},
getPrintHeader(): PrintHeader {
return this.globalData.printHeader || 'wechat';
getPrintConfig(): PrintConfig {
return this.globalData.printConfig || {
header: 'wechat',
appName: '涂鸦丫小程序'
};
},
setPrintHeader(header: PrintHeader) {
header = header || 'wechat';
this.globalData.printHeader = header;
wx.setStorageSync('printHeader', header);
setPrintConfig(config: PrintConfig) {
this.globalData.printConfig = config;
wx.setStorageSync('printConfig', config);
}
});