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.
This commit is contained in:
28
08-vue3/04-lifecycle-and-template-ref/starter.js
Normal file
28
08-vue3/04-lifecycle-and-template-ref/starter.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const { createApp, ref, onMounted, onUpdated, onUnmounted } = Vue;
|
||||
|
||||
createApp({
|
||||
setup() {
|
||||
const keyword = ref("");
|
||||
const keywordInput = ref(null);
|
||||
let timer = null;
|
||||
|
||||
onMounted(() => {
|
||||
// 任务:
|
||||
// 1. 让输入框自动聚焦
|
||||
// 2. 建立一个定时器
|
||||
});
|
||||
|
||||
onUpdated(() => {
|
||||
// 任务:输出 updated 日志
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// 任务:清理定时器并输出销毁日志
|
||||
});
|
||||
|
||||
return {
|
||||
keyword,
|
||||
keywordInput,
|
||||
};
|
||||
},
|
||||
}).mount("#app");
|
||||
Reference in New Issue
Block a user