使用 TypeScript 构建 TodoIt 应用:功能实现与调试指南
1. 过滤现有待办事项
要实现待办事项的过滤功能,首先需要对 index.html 中的 todoFilter 输入框进行修改:
<input type="text" id="todoFilter" title="Filter for the todo list"
onkeyup="filterTodoList()" onblur="filterTodoList()" />
接下来,需要在 TypeScript 中实现 filterTodoList 函数:
function filterTodoList(): void {
console.log("Filtering the rendered todo list");
const todoListHtml: HTMLUListElement =
document.getElementById('todoList') as HTMLUListElement;
if (todoListHtml === null) {
console.log("Nothing to filter");
return;
}
const todoListFilter = document.getElementById('todoFilte
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



