feat: add Vue2 exercises for dynamic styles, lifecycle methods, component communication, and course management dashboard
- 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.
This commit is contained in:
65
07-vue2/09-final-course-dashboard/starter.html
Normal file
65
07-vue2/09-final-course-dashboard/starter.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vue2 综合课程管理面板</title>
|
||||
<style>
|
||||
body { margin: 0; padding: 32px; font-family: "PingFang SC", sans-serif; background: #f4f7fb; }
|
||||
.page { max-width: 960px; margin: 0 auto; display: grid; gap: 18px; }
|
||||
.panel { padding: 22px; border-radius: 20px; background: #fff; border: 1px solid #d9e4f1; }
|
||||
.toolbar { display: grid; grid-template-columns: 1fr 180px 160px; gap: 12px; }
|
||||
input, select, button { padding: 12px 14px; border-radius: 12px; border: 1px solid #cad6e8; font: inherit; }
|
||||
button { border: 0; background: #2d6cdf; color: #fff; cursor: pointer; }
|
||||
.list { display: grid; gap: 14px; }
|
||||
.course-card { padding: 18px; border-radius: 16px; border: 1px solid #dbe4f1; background: #fbfcfe; }
|
||||
.course-card.is-done { border-color: #6cc18a; background: #f3fbf6; }
|
||||
.meta { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
|
||||
.badge { display: inline-flex; padding: 4px 10px; border-radius: 999px; background: #edf4ff; color: #2d6cdf; font-size: 12px; }
|
||||
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
|
||||
.empty { padding: 18px; border-radius: 16px; background: #fff6e8; color: #a06200; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<section id="app" class="page">
|
||||
<article class="panel">
|
||||
<h1>Vue2 课程管理面板</h1>
|
||||
<div class="toolbar">
|
||||
<input ref="searchInput" v-model="keyword" type="text" placeholder="输入课程关键字" />
|
||||
<select v-model="statusFilter">
|
||||
<option value="all">全部</option>
|
||||
<option value="done">已完成</option>
|
||||
<option value="doing">学习中</option>
|
||||
</select>
|
||||
<button type="button" @click="focusSearch">聚焦搜索框</button>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<section class="panel">
|
||||
<div v-if="!filteredCourses.length" class="empty">暂无匹配结果</div>
|
||||
|
||||
<div v-show="filteredCourses.length" class="list">
|
||||
<course-item
|
||||
v-for="course in filteredCourses"
|
||||
:key="course.id"
|
||||
:course="course"
|
||||
@toggle="toggleCourse"
|
||||
>
|
||||
<template v-slot:action>
|
||||
切换完成状态
|
||||
</template>
|
||||
</course-item>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer class="panel stats">
|
||||
<div>总课程数:{{ totalCount }}</div>
|
||||
<div>已完成数:{{ finishedCount }}</div>
|
||||
<div>当前筛选数:{{ visibleCount }}</div>
|
||||
</footer>
|
||||
</section>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
|
||||
<script src="./starter.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user