logs.ts 408 B

123456789101112131415161718192021
  1. // logs.ts
  2. // const util = require('../../utils/util.js')
  3. import { formatTime } from '../../utils/util'
  4. Component({
  5. data: {
  6. logs: [],
  7. },
  8. lifetimes: {
  9. attached() {
  10. this.setData({
  11. logs: (wx.getStorageSync('logs') || []).map((log: string) => {
  12. return {
  13. date: formatTime(new Date(log)),
  14. timeStamp: log
  15. }
  16. }),
  17. })
  18. }
  19. },
  20. })