clearCompleted: function () {
// for循环实现
// for(var i = 0; i < this.todos.length; i++) {
// if (this.todos[i].completed) {
// console.log(1)
// this.todos.splice(i, 1)
// //前面的被删了,后面的所有元素索引要减1,因为前面的被删了,后面的索引都变了
// i--
// }
// }
// 错误方法,不能再foreach里面删除数组元素,因为删除一个后面的索引变了
// this.todos.forEach(function (item, i) {
// if (item.completed) {
// todos.splice(i, 1)
// }
// })
// 简单粗暴的方法,数筛选,给todos重新赋值,把符合条件的放进去
this.todos = this.todos.filter(item => !item.completed)
}