feat:优化 debug 页
This commit is contained in:
@@ -1,27 +1,38 @@
|
||||
Page({
|
||||
data: {
|
||||
header: 'wechat',
|
||||
printConfig: {
|
||||
header: 'wechat',
|
||||
appName: '涂鸦丫小程序'
|
||||
},
|
||||
enableDebug: false
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
const header = getApp().getPrintHeader() || 'wechat';
|
||||
const printConfig = getApp().getPrintConfig() || {
|
||||
header: 'wechat',
|
||||
appName: '涂鸦丫小程序'
|
||||
};
|
||||
const enableDebug = wx.getStorageSync('enableDebug') || false;
|
||||
this.setData({ header, enableDebug });
|
||||
this.setData({ printConfig, enableDebug });
|
||||
},
|
||||
|
||||
onChangeHeader(e: WechatMiniprogram.CustomEvent) {
|
||||
const header = e.detail.value as PrintHeader;
|
||||
this.setData({ header });
|
||||
this.setData({ printConfig: { ...this.data.printConfig, header } });
|
||||
},
|
||||
|
||||
onClickHeaderSetting(e: WechatMiniprogram.CustomEvent) {
|
||||
const header = e.currentTarget.dataset.name as PrintHeader;
|
||||
this.setData({ header });
|
||||
this.setData({ printConfig: { ...this.data.printConfig, header } });
|
||||
},
|
||||
|
||||
onAppNameChange(e: WechatMiniprogram.CustomEvent) {
|
||||
const appName = e.detail + '';
|
||||
this.setData({ printConfig: { ...this.data.printConfig, appName } });
|
||||
},
|
||||
|
||||
onConfirm() {
|
||||
getApp().setPrintHeader(this.data.header);
|
||||
getApp().setPrintConfig(this.data.printConfig);
|
||||
const enableDebug = this.data.enableDebug;
|
||||
wx.setStorageSync('enableDebug', enableDebug);
|
||||
wx.setEnableDebug({ enableDebug });
|
||||
|
||||
Reference in New Issue
Block a user