fix(vitepress): fix docs site title

This commit is contained in:
Sagi 2022-10-06 01:03:13 +08:00
parent 59346761d9
commit eda8dabc4e
3 changed files with 23 additions and 22 deletions

View File

@ -5,7 +5,7 @@ import sidebar from './sidebar';
import markdown from './markdown'; import markdown from './markdown';
const config = defineConfig({ const config = defineConfig({
title: ' ', title: 'Farris Vue',
description: '基于 Farris Design 的前端组件库', description: '基于 Farris Design 的前端组件库',
head, head,
markdown, markdown,

View File

@ -1,19 +1,19 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRoute, useData } from 'vitepress' import { useRoute, useData } from "vitepress";
import { useCopyCode } from '../composables/copy-code.js' import { useCopyCode } from "../composables/copy-code.js";
import { useSidebar } from '../composables/sidebar.js' import { useSidebar } from "../composables/sidebar.js";
import Theme from '@theme/index' import Theme from "@theme/index";
import VPPage from './VPPage.vue' import VPPage from "./VPPage.vue";
import VPHome from './VPHome.vue' import VPHome from "./VPHome.vue";
import VPDoc from './VPDoc.vue' import VPDoc from "./VPDoc.vue";
const route = useRoute() const route = useRoute();
const { frontmatter } = useData() const { frontmatter } = useData();
const { hasSidebar } = useSidebar() const { hasSidebar } = useSidebar();
const NotFound = Theme.NotFound || (() => '404 Not Found') const NotFound = Theme.NotFound || (() => "404 Not Found");
useCopyCode() useCopyCode();
</script> </script>
<template> <template>
@ -22,7 +22,7 @@ useCopyCode()
id="VPContent" id="VPContent"
:class="{ :class="{
'has-sidebar': hasSidebar, 'has-sidebar': hasSidebar,
'is-home': frontmatter.layout === 'home' 'is-home': frontmatter.layout === 'home',
}" }"
> >
<NotFound v-if="route.component === NotFound" /> <NotFound v-if="route.component === NotFound" />
@ -72,6 +72,7 @@ useCopyCode()
.VPContent.has-sidebar { .VPContent.has-sidebar {
margin: 0; margin: 0;
padding-left: var(--vp-sidebar-width); padding-left: var(--vp-sidebar-width);
background-color: rgba(255, 255, 255, 0.7);
} }
} }

View File

@ -1,10 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { useData } from 'vitepress' import { useData } from "vitepress";
import { useSidebar } from '../composables/sidebar.js' import { useSidebar } from "../composables/sidebar.js";
import VPImage from './VPImage.vue' import VPImage from "./VPImage.vue";
const { site, theme } = useData() const { site, theme } = useData();
const { hasSidebar } = useSidebar() const { hasSidebar } = useSidebar();
</script> </script>
<template> <template>
@ -12,8 +12,8 @@ const { hasSidebar } = useSidebar()
<a class="title" :href="site.base"> <a class="title" :href="site.base">
<slot name="nav-bar-title-before" /> <slot name="nav-bar-title-before" />
<VPImage class="logo" :image="theme.logo" /> <VPImage class="logo" :image="theme.logo" />
<template v-if="theme.siteTitle">{{ theme.siteTitle }}</template> <!-- <template v-if="theme.siteTitle">{{ theme.siteTitle }}</template>
<template v-else-if="theme.siteTitle === undefined">{{ site.title }}</template> <template v-else-if="theme.siteTitle === undefined">{{ site.title }}</template> -->
<slot name="nav-bar-title-after" /> <slot name="nav-bar-title-after" />
</a> </a>
</div> </div>
@ -33,7 +33,7 @@ const { hasSidebar } = useSidebar()
/* background-color: var(--vp-c-bg-alt); */ /* background-color: var(--vp-c-bg-alt); */
padding-left: 32px; padding-left: 32px;
margin-right: 0; margin-right: 0;
background-color: rgba(255,255,255,.7); background-color: rgba(255, 255, 255, 0.7);
width: var(--vp-sidebar-width); width: var(--vp-sidebar-width);
backdrop-filter: saturate(50%) blur(8px); backdrop-filter: saturate(50%) blur(8px);
padding-right: 32px; padding-right: 32px;