修改配色,修改功能

This commit is contained in:
2026-02-08 15:43:32 +08:00
parent 17e32d7cc1
commit fa1a8e083e
14 changed files with 441 additions and 119 deletions

View File

@@ -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;