todoListComputed () {
const {
currentStatus,
todoList
} = this
if (currentStatus === ALL) return todoList
if (currentStatus === COMPLETE) return todoList.filter(todo => todo.isComplete) // 单行语句可省略 {}
if (currentStatus === TODO) return todoList.filter(todo => !todo.isComplete) // 单行语句可省略 {}
},
这是某一项目的源代码,const { currentStatus,todoList} = this
部分我没查到文档,不理解什么用的
麻烦大神帮忙解释一下 谢谢
对象的解构赋值
参考这里 ES6入门