- 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.
26 lines
927 B
HTML
26 lines
927 B
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>生命周期和异步更新</title>
|
|
<style>
|
|
body { margin: 0; padding: 32px; font-family: "PingFang SC", sans-serif; background: #f6f8fb; }
|
|
.panel { max-width: 760px; margin: 0 auto; padding: 24px; border-radius: 18px; background: #fff; border: 1px solid #dce4f1; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<section id="app" class="panel">
|
|
<h1>生命周期练习</h1>
|
|
<button type="button" @click="destroyInstance">销毁当前实例</button>
|
|
<p v-if="loading">数据加载中...</p>
|
|
<ul v-else>
|
|
<li v-for="item in courses" :key="item.id">{{ item.title }}</li>
|
|
</ul>
|
|
</section>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
|
|
<script src="./answer.js"></script>
|
|
</body>
|
|
</html>
|