收藏
回答

手机上运行出错没反应。a.push is not a function求大神指点

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)

  },


回答关注问题邀请回答
收藏
登录 后发表内容