Skip to content

Commit c278ed7

Browse files
LessUpqwencoder
andcommitted
fix: 添加缺失的VitePress自定义Vue组件文件
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent df5862c commit c278ed7

8 files changed

Lines changed: 186 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<div class="algorithm-showcase">
3+
<slot />
4+
</div>
5+
</template>
6+
7+
<script setup>
8+
</script>
9+
10+
<style scoped>
11+
.algorithm-showcase {
12+
padding: 1rem;
13+
}
14+
</style>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<div class="animated-hero">
3+
<slot />
4+
</div>
5+
</template>
6+
7+
<script setup>
8+
</script>
9+
10+
<style scoped>
11+
.animated-hero {
12+
animation: fadeIn 0.5s ease-in;
13+
}
14+
15+
@keyframes fadeIn {
16+
from { opacity: 0; }
17+
to { opacity: 1; }
18+
}
19+
</style>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<template>
2+
<button class="back-to-top" @click="scrollToTop" v-show="visible">
3+
4+
</button>
5+
</template>
6+
7+
<script setup>
8+
import { ref, onMounted, onUnmounted } from 'vue'
9+
10+
const visible = ref(false)
11+
12+
const scrollToTop = () => {
13+
window.scrollTo({ top: 0, behavior: 'smooth' })
14+
}
15+
16+
const handleScroll = () => {
17+
visible.value = window.scrollY > 300
18+
}
19+
20+
onMounted(() => {
21+
window.addEventListener('scroll', handleScroll)
22+
})
23+
24+
onUnmounted(() => {
25+
window.removeEventListener('scroll', handleScroll)
26+
})
27+
</script>
28+
29+
<style scoped>
30+
.back-to-top {
31+
position: fixed;
32+
bottom: 2rem;
33+
right: 2rem;
34+
width: 3rem;
35+
height: 3rem;
36+
border-radius: 50%;
37+
background: var(--vp-c-brand);
38+
color: white;
39+
border: none;
40+
cursor: pointer;
41+
font-size: 1.5rem;
42+
display: flex;
43+
align-items: center;
44+
justify-content: center;
45+
}
46+
</style>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<div class="code-playground">
3+
<slot />
4+
</div>
5+
</template>
6+
7+
<script setup>
8+
</script>
9+
10+
<style scoped>
11+
.code-playground {
12+
padding: 1rem;
13+
}
14+
</style>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<template>
2+
<footer class="custom-footer">
3+
<p>Custom Footer</p>
4+
</footer>
5+
</template>
6+
7+
<script setup>
8+
</script>
9+
10+
<style scoped>
11+
.custom-footer {
12+
text-align: center;
13+
padding: 1rem;
14+
}
15+
</style>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<div class="feature-card">
3+
<slot />
4+
</div>
5+
</template>
6+
7+
<script setup>
8+
defineProps({
9+
title: {
10+
type: String,
11+
default: ''
12+
}
13+
})
14+
</script>
15+
16+
<style scoped>
17+
.feature-card {
18+
border-radius: 8px;
19+
padding: 1rem;
20+
}
21+
</style>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<div class="language-switcher">
3+
<slot />
4+
</div>
5+
</template>
6+
7+
<script setup>
8+
</script>
9+
10+
<style scoped>
11+
.language-switcher {
12+
padding: 0.5rem;
13+
}
14+
</style>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<template>
2+
<div class="reading-progress">
3+
<div class="progress-bar" :style="{ width: progress + '%' }"></div>
4+
</div>
5+
</template>
6+
7+
<script setup>
8+
import { ref, onMounted, onUnmounted } from 'vue'
9+
10+
const progress = ref(0)
11+
12+
const updateProgress = () => {
13+
const scrollTop = window.scrollY
14+
const docHeight = document.documentElement.scrollHeight - window.innerHeight
15+
progress.value = docHeight > 0 ? (scrollTop / docHeight) * 100 : 0
16+
}
17+
18+
onMounted(() => {
19+
window.addEventListener('scroll', updateProgress)
20+
updateProgress()
21+
})
22+
23+
onUnmounted(() => {
24+
window.removeEventListener('scroll', updateProgress)
25+
})
26+
</script>
27+
28+
<style scoped>
29+
.reading-progress {
30+
position: fixed;
31+
top: 0;
32+
left: 0;
33+
width: 100%;
34+
height: 3px;
35+
z-index: 100;
36+
}
37+
38+
.progress-bar {
39+
height: 100%;
40+
background: var(--vp-c-brand);
41+
transition: width 0.1s;
42+
}
43+
</style>

0 commit comments

Comments
 (0)