// logs.js
const util = require('../../utils/util.js')

Page({
  data: {
    logs: [],
    conf: []
  },
  onLoad() {
    this.setData({
      logs: (wx.getStorageSync('logs') || []).map(log => {
        return {
          date: util.formatTime(new Date(log)),
          timeStamp: log
        }
      }),
      conf: wx.getStorageSync('conf') || {}
    })
  },
   clearStorageSync() {
    wx.clearStorageSync();
    wx.showToast({
      title: '缓存已清除',
      icon: 'success',
      duration: 2000
    });
    // 清除缓存后，可以重新加载数据或重置页面状态
    this.setData({
      logs: [],
      conf: {}
    });
  }
})
