feat: add TypeScript lessons and learning panel

- Introduced a new script to check TypeScript lesson files for errors.
- Created a main TypeScript file to render lessons and their details.
- Added lesson definitions with starter and answer codes.
- Implemented a user interface for navigating and running lessons.
- Styled the application with CSS for a better user experience.
- Updated README to reflect the new TypeScript section and usage instructions.
This commit is contained in:
charlie
2026-03-19 10:06:11 +08:00
parent 69a4ae3178
commit f3bdaa4e88
146 changed files with 5951 additions and 9 deletions

View File

@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>冒泡、委托和 stopPropagation</title>
<style>
body {
margin: 0;
padding: 32px;
font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
background: #f5f7fb;
}
.panel {
max-width: 760px;
margin: 0 auto;
padding: 24px;
border-radius: 20px;
background: #ffffff;
border: 1px solid #dbe2ee;
}
.lesson-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 14px;
border: 1px solid #dbe2ee;
border-radius: 12px;
margin-top: 10px;
}
.lesson-item.active {
background: #dbeafe;
}
</style>
</head>
<body>
<section id="panel" class="panel">
<h1>事件委托练习</h1>
<p>点击列表项可以切换高亮,点击删除按钮可以移除当前项。</p>
<ul id="lesson-list">
<li class="lesson-item">
<span>事件冒泡</span>
<button class="remove-btn" type="button">删除</button>
</li>
<li class="lesson-item">
<span>事件委托</span>
<button class="remove-btn" type="button">删除</button>
</li>
</ul>
</section>
<script src="./answer.js"></script>
</body>
</html>