- Introduced Vue3 exercises covering composable API, reactivity, lifecycle hooks, and built-in components. - Added structured interview plan for frontend candidates focusing on HTML, CSS, JavaScript, TypeScript, and Vue. - Included starter files for each exercise and detailed README documentation for guidance.
25 lines
655 B
Markdown
25 lines
655 B
Markdown
# 练习 9:toRef、toRefs 和 readonly
|
||
|
||
## 目标
|
||
|
||
学会把响应式对象里的字段拆出来继续保持响应式,并理解只读数据的使用场景。
|
||
|
||
## 你要练什么
|
||
|
||
- `toRef`
|
||
- `toRefs`
|
||
- `readonly`
|
||
|
||
## 任务
|
||
|
||
- 用 `reactive` 管理学习者信息
|
||
- 用 `toRef` 单独取出 `name`
|
||
- 用 `toRefs` 拆出其余字段
|
||
- 用 `readonly` 包一层设置项
|
||
- 点击按钮更新学习者信息并观察页面变化
|
||
|
||
## 文件
|
||
|
||
- [starter.html](/Users/lijiaqing/home/wwwroot/front-end-example/08-vue3/09-reactivity-helpers/starter.html)
|
||
- [starter.js](/Users/lijiaqing/home/wwwroot/front-end-example/08-vue3/09-reactivity-helpers/starter.js)
|