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)
},