- 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.
练习 5:computed 和 watch
目标
学会区分“根据已有数据推导结果”和“监听变化做额外动作”。
你要练什么
computedwatch- 数据推导
- 监听输入变化
任务
请基于页面结构完成以下操作:
- 根据关键字过滤课程列表
- 用
computed计算过滤结果数量 - 用
watch在关键字变化时输出日志