From c9b8ac0a669339c50aae591092a6628daf55c94a Mon Sep 17 00:00:00 2001 From: dichgrem Date: Fri, 28 Nov 2025 10:32:11 +0800 Subject: [PATCH] feat:console_log --- todos/src/App.vue | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/todos/src/App.vue b/todos/src/App.vue index fd0859d..5241670 100644 --- a/todos/src/App.vue +++ b/todos/src/App.vue @@ -30,36 +30,44 @@ export default { }, }, + methods: { - // 添加待办 addTodo(newTodo) { - this.todos.push({ + const todo = { id: Date.now(), txt: newTodo, completed: false, - }); + }; + this.todos.push(todo); + console.log("添加 Todo:", todo); }, - // 删除待办 delTodo(item) { + console.log("删除 Todo:", item); this.todos = this.todos.filter((t) => t.id !== item.id); }, + toggleTodo(item) { + console.log("完成状态切换:", item); + }, + changeTabType(type) { + console.log("切换 Tab:", type); this.tabType = type; }, }, - // 深度监听 — 自动写入 localStorage watch: { todos: { handler(todos) { + console.log("Todos 改变:", todos); localStorage.setItem("vue-todos", JSON.stringify(todos)); }, deep: true, }, }, }; +