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:
23
08-vue3/01-create-app-and-ref/README.md
Normal file
23
08-vue3/01-create-app-and-ref/README.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 练习 1:createApp、setup 和 ref
|
||||
|
||||
## 目标
|
||||
|
||||
学会用 Vue3 的 `createApp` 和 `setup()` 启动页面,并用 `ref` 创建最基础的响应式数据。
|
||||
|
||||
## 你要练什么
|
||||
|
||||
- `createApp`
|
||||
- `setup()`
|
||||
- `ref`
|
||||
- 模板插值
|
||||
|
||||
## 任务
|
||||
|
||||
- 显示页面标题和学习人数
|
||||
- 点击按钮后让人数加 1
|
||||
- 在控制台输出最新人数
|
||||
|
||||
## 文件
|
||||
|
||||
- [starter.html](/Users/lijiaqing/home/wwwroot/front-end-example/08-vue3/01-create-app-and-ref/starter.html)
|
||||
- [starter.js](/Users/lijiaqing/home/wwwroot/front-end-example/08-vue3/01-create-app-and-ref/starter.js)
|
||||
23
08-vue3/01-create-app-and-ref/starter.html
Normal file
23
08-vue3/01-create-app-and-ref/starter.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>createApp、setup 和 ref</title>
|
||||
<style>
|
||||
body { margin: 0; padding: 32px; font-family: "PingFang SC", sans-serif; background: #f5f7fb; }
|
||||
.panel { max-width: 720px; margin: 0 auto; padding: 24px; border-radius: 18px; background: #fff; border: 1px solid #dce5f2; }
|
||||
button { padding: 10px 16px; border: 0; border-radius: 999px; background: #2d6cdf; color: #fff; cursor: pointer; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<section id="app" class="panel">
|
||||
<h1>{{ title }}</h1>
|
||||
<p>当前学习人数:{{ learnerCount }}</p>
|
||||
<button type="button" @click="increaseLearner">加入学习</button>
|
||||
</section>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@3/dist/vue.global.js"></script>
|
||||
<script src="./starter.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
20
08-vue3/01-create-app-and-ref/starter.js
Normal file
20
08-vue3/01-create-app-and-ref/starter.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const { createApp, ref } = Vue;
|
||||
|
||||
createApp({
|
||||
setup() {
|
||||
const title = ref("Vue3 基础入门");
|
||||
const learnerCount = ref(16);
|
||||
|
||||
function increaseLearner() {
|
||||
// 任务:
|
||||
// 1. learnerCount 加 1
|
||||
// 2. 在控制台输出最新人数
|
||||
}
|
||||
|
||||
return {
|
||||
title,
|
||||
learnerCount,
|
||||
increaseLearner,
|
||||
};
|
||||
},
|
||||
}).mount("#app");
|
||||
Reference in New Issue
Block a user