feat: add Vue2 exercises for dynamic styles, lifecycle methods, component communication, and course management dashboard

- Implement dynamic styles and event handling in Vue2 with a card component.
- Create lifecycle methods exercise to simulate async data loading and instance destruction.
- Develop a component communication exercise with props, events, and slots.
- Build a comprehensive course management dashboard with filtering, statistics, and component interactions.
This commit is contained in:
charlie
2026-03-23 10:09:29 +08:00
parent 00d3c9e4c6
commit 3435848495
48 changed files with 1705 additions and 48 deletions

View File

@@ -0,0 +1,33 @@
# 练习 8组件通信与综合练习
## 目标
把 Vue2 最核心的组件能力串起来,完成一个小型页面。
## 你要练什么
- 组件注册(全局 / 局部)
- `props`
- `props` 校验
- `$emit`
- `slot`
- `ref`
## 任务
请基于页面结构完成以下操作:
- 把课程卡片拆成子组件
- 注册一个全局角标组件
- 父组件通过 `props` 传课程数据
-`props` 补上类型、必填、默认值或校验规则
- 子组件点击按钮后通过 `$emit` 通知父组件切换状态
-`slot` 自定义按钮文案
-`ref` 聚焦输入框
## 文件
- [starter.html](/Users/lijiaqing/home/wwwroot/front-end-example/07-vue2/08-components-communication-and-final/starter.html)
- [starter.js](/Users/lijiaqing/home/wwwroot/front-end-example/07-vue2/08-components-communication-and-final/starter.js)
- [answer.html](/Users/lijiaqing/home/wwwroot/front-end-example/07-vue2/08-components-communication-and-final/answer.html)
- [answer.js](/Users/lijiaqing/home/wwwroot/front-end-example/07-vue2/08-components-communication-and-final/answer.js)