手机上运行出错没反应。a.push is not a function求大神指点
发布于 5 年前 作者 ming96 1683 次浏览 来自 问答

todoChange: function (e) {

    if (!this.data.input || !this.data.input.trim()) return

    var hide = this.data.hide

    if (hide){

      var todos = this.data.todos

    }else{

      var todos = wx.getStorageSync(‘todo_list’)

    }

    todos.push({

      name: this.data.input,

      completed: false

    })

 

    var logs = wx.getStorageSync(‘todo_logs’) //2017.7.27

    logs.push({

      timestamp: (new Date()).toLocaleString(),

      action: ‘新增’,

      name: this.data.input

    })

    this.setData({

      input: ‘’,

      todos: todos,

      Count: this.data.Count + 1,

      logs: logs

    })

 

wx.setStorageSync(‘todo_list’, this.data.todos)

    wx.setStorageSync(‘todo_logs’, this.data.logs)

  },

回到顶部