blog/.vitepress/theme/Layout.vue
2025-03-28 23:22:10 +08:00

80 lines
1.5 KiB
Vue

<template>
<Header />
<aside />
<main>
<ToTop />
<template v-if="path === ''">
<Banner />
<BlogList :posts="posts" />
</template>
<Tag v-else-if="path === 'tags/'" />
<Article v-else />
</main>
</template>
<script setup lang="ts">
import Header from './Header.vue'
import Banner from './Banner.vue'
import Article from './Article.vue'
import BlogList from './BlogList.vue'
import Tag from './Tag.vue'
import ToTop from './ToTop.vue'
import { computed } from 'vue'
import { useRoute, useData } from 'vitepress'
import { data as posts } from '../posts.data'
const base = useData().site.value.base
const route = useRoute()
const path = computed(() => route.path.replace(base, '').replace('index.html', ''))
</script>
<style lang="scss">
html {
scroll-behavior: smooth;
--global-font: "Noto Serif SC", "MicroSoft Yahei", serif;
--color-accent: #fe9600;
--color-gray: #666;
--color-text: #02111d;
--color-background: #eee;
--color-border: #d0d7de;
--code-line-height: 24px;
--code-font-family: monospace;
--code-font-size: 15px;
}
body {
margin: 0;
padding: 0;
font-family: var(--global-font);
font-size: 16px;
overflow-x: hidden;
}
* {
box-sizing: border-box;
}
a {
text-decoration: none;
}
img {
max-width: 100%;
}
hr {
border: none;
border-bottom: 1px dashed var(--color-border);
}
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-thumb {
border-radius: 4px;
background: var(--color-accent);
}
</style>