- 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.
907 B
907 B
练习 6:冒泡、委托和 stopPropagation
目标
理解事件会冒泡,并学会在列表里使用事件委托。
你要练什么
- 事件冒泡
event.target- 事件委托
stopPropagation()
任务
- 点击外层面板时输出一条日志
- 点击列表项时,通过事件委托切换激活状态
- 点击列表项里的删除按钮时,阻止冒泡并删除当前项