Files
front-end-example/08-vue3/11-before-hooks-and-expose/README.md
charlie d0d8be443b feat: Add Vue3 exercises and interview plan
- 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.
2026-03-24 23:02:58 +08:00

735 B
Raw Blame History

练习 11before 系列生命周期和 expose

目标

学会在组合式 API 中使用 before 系列生命周期,并理解子组件如何有选择地暴露能力给父组件。

你要练什么

  • onBeforeMount
  • onBeforeUpdate
  • onBeforeUnmount
  • expose

任务

  • 在不同生命周期里输出日志
  • 父组件通过模板 ref 获取子组件实例
  • 子组件通过 expose 暴露一个 focusInput 方法
  • 父组件点击按钮后调用这个暴露出来的方法

文件