import { config } from '../../config'; Page({ onLoad() { wx.showShareMenu({ withShareTicket: true, menus: ['shareAppMessage', 'shareTimeline'] }); }, onShareAppMessage() { return config.share; }, onShareTimeline() { return config.share; }, data: { historyList: [] }, onShow() { const list = wx.getStorageSync('CALC_HISTORY') || []; this.setData({ historyList: list }); }, clearHistory() { wx.showModal({ title: '提示', content: '确定要清空所有记录吗?', success: (res) => { if (res.confirm) { wx.removeStorageSync('CALC_HISTORY'); this.setData({ historyList: [] }); } } }); } });