修改配色,修改功能
This commit is contained in:
@@ -8,9 +8,27 @@ Page({
|
||||
waitingForSecondOperand: false,
|
||||
isScientific: false,
|
||||
showHistory: false,
|
||||
showHelp: false,
|
||||
historyList: [] as Array<{expression: string, result: string}>
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: '便捷好用的科学计算器',
|
||||
path: '/pages/calculator/calculator'
|
||||
}
|
||||
},
|
||||
|
||||
onShareTimeline() {
|
||||
return {
|
||||
title: '便捷好用的科学计算器'
|
||||
}
|
||||
},
|
||||
|
||||
toggleHelp() {
|
||||
this.setData({ showHelp: !this.data.showHelp });
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
// 从本地存储恢复历史记录
|
||||
const saved = wx.getStorageSync('CALC_HISTORY');
|
||||
@@ -34,6 +52,15 @@ Page({
|
||||
});
|
||||
},
|
||||
|
||||
switchMode(e: any) {
|
||||
const mode = e.currentTarget.dataset.mode;
|
||||
const isSci = (mode === 'scientific');
|
||||
if (this.data.isScientific !== isSci) {
|
||||
this.vibrate();
|
||||
this.setData({ isScientific: isSci });
|
||||
}
|
||||
},
|
||||
|
||||
onDigit(e: any) {
|
||||
this.vibrate();
|
||||
const digit = e.currentTarget.dataset.digit;
|
||||
|
||||
Reference in New Issue
Block a user