feat:优化 debug 页
This commit is contained in:
+18
-9
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user