47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
Page({
|
|
data: {
|
|
printConfig: {
|
|
header: 'wechat',
|
|
appName: '涂鸦丫小程序'
|
|
},
|
|
enableDebug: false
|
|
},
|
|
|
|
onLoad() {
|
|
const printConfig = getApp().getPrintConfig() || {
|
|
header: 'wechat',
|
|
appName: '涂鸦丫小程序'
|
|
};
|
|
const enableDebug = wx.getStorageSync('enableDebug') || false;
|
|
this.setData({ printConfig, enableDebug });
|
|
},
|
|
|
|
onChangeHeader(e: WechatMiniprogram.CustomEvent) {
|
|
const header = e.detail.value as PrintHeader;
|
|
this.setData({ printConfig: { ...this.data.printConfig, header } });
|
|
},
|
|
|
|
onClickHeaderSetting(e: WechatMiniprogram.CustomEvent) {
|
|
const header = e.currentTarget.dataset.name as PrintHeader;
|
|
this.setData({ printConfig: { ...this.data.printConfig, header } });
|
|
},
|
|
|
|
onAppNameChange(e: WechatMiniprogram.CustomEvent) {
|
|
const appName = e.detail + '';
|
|
this.setData({ printConfig: { ...this.data.printConfig, appName } });
|
|
},
|
|
|
|
onConfirm() {
|
|
getApp().setPrintConfig(this.data.printConfig);
|
|
const enableDebug = this.data.enableDebug;
|
|
wx.setStorageSync('enableDebug', enableDebug);
|
|
wx.setEnableDebug({ enableDebug });
|
|
wx.navigateBack();
|
|
},
|
|
|
|
/** 真机调试线上包 */
|
|
toggleDebug() {
|
|
const enableDebug = !this.data.enableDebug;
|
|
this.setData({ enableDebug });
|
|
}
|
|
}); |