← 教程列表
news

Task 2: Todo Store

📅 2026/6/12 16:30:02⏱ 约 5 分钟阅读👁 7 阅读

Create the Svelte store for todo state management. **Do:** - Create `src/lib/store.ts` - Define `Todo` interface with id, text, completed - Create writable store with initial empty array - Export functions: `addTodo(text)`, `toggleTodo(id)`, `deleteTodo(id)`, `clearCompleted()` - Create `src/lib/store.test.ts` with tests for each function **Verify:** - Tests pass: `npm run test` (install vitest if needed) ---

← 返回教程列表 AI8899 · 内容仅供学习参考