1234567891011121314151617181920212223242526272829303132333435363738394041 |
- Page({
- data: {
- countThreshold: 3, // 条数阈值
- percentageThreshold: 70 // 百分比阈值
- },
- // 修改条数阈值
- updateCountThreshold(e) {
- this.setData({
- countThreshold: Number(e.detail.value)
- });
- },
- // 修改百分比阈值
- updatePercentageThreshold(e) {
- this.setData({
- percentageThreshold: Number(e.detail.value)
- });
- },
- // 保存设置
- saveSettings() {
- const { countThreshold, percentageThreshold } = this.data;
- const app = getApp();
- // 更新全局变量
- app.globalData.triggerThreshold = {
- count: countThreshold,
- percentage: percentageThreshold
- };
- // 持久化存储
- wx.setStorageSync('triggerThreshold', app.globalData.triggerThreshold);
- wx.showToast({
- title: '设置已保存',
- icon: 'success',
- duration: 2000
- });
- }
- });
|