2020年5月11日
摘要: 点击清除已完成按钮,把列表中的已完成就会被清除,只剩下未完成的任务事项。 1、给“清除已完成”添加点击事件: <!--把已经完成的任务清空--> <a @click="clean">清除已完成</a> <script> export default { methods: { // 清除已完成的任务事 阅读全文
posted @ 2020-05-11 16:57 JoeYoung 阅读(463) 评论(0) 推荐(0) 编辑
摘要: 使用 getters 包装器 1、定义 getters 函数: getters: { // 统计未完成任务的条数 unDoneLength(state) { return state.list.filter(item => item.done false).length } } 2、引入 gette 阅读全文
posted @ 2020-05-11 14:09 JoeYoung 阅读(329) 评论(0) 推荐(0) 编辑