CustomVPHome.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <script setup lang="ts">
  2. import VPHomeHero from 'vitepress/dist/client/theme-default/components/VPHomeHero.vue'
  3. import VPHomeFeatures from 'vitepress/dist/client/theme-default/components/VPHomeFeatures.vue'
  4. import VPHomeContent from 'vitepress/dist/client/theme-default/components/VPHomeContent.vue'
  5. import { useData } from "vitepress";
  6. const { frontmatter } = useData()
  7. </script>
  8. <template>
  9. <div class="VPHome">
  10. <slot name="home-hero-before" />
  11. <VPHomeHero>
  12. <template #home-hero-info-before><slot name="home-hero-info-before" /></template>
  13. <template #home-hero-info><slot name="home-hero-info" /></template>
  14. <template #home-hero-info-after><slot name="home-hero-info-after" /></template>
  15. <template #home-hero-actions-after><slot name="home-hero-actions-after" /></template>
  16. <template #home-hero-image><slot name="home-hero-image" /></template>
  17. </VPHomeHero>
  18. <slot name="home-hero-after" />
  19. <slot name="home-features-before" />
  20. <VPHomeFeatures />
  21. <slot name="home-features-after" />
  22. <VPHomeContent v-if="frontmatter.markdownStyles !== false">
  23. <Content />
  24. </VPHomeContent>
  25. <Content v-else />
  26. </div>
  27. </template>
  28. <style scoped>
  29. .VPHome {
  30. margin-bottom: 96px;
  31. }
  32. @media (max-width: 640px) {
  33. .VPHome {
  34. background: linear-gradient(to bottom, #E7EEFE 0%, #FAFCFF 800px, #FFFFFF 100%);
  35. }
  36. .VPHome :deep(.vp-doc) {
  37. padding: 0 14px;
  38. }
  39. }
  40. @media (min-width: 768px) {
  41. .VPHome {
  42. margin-bottom: 128px;
  43. }
  44. }
  45. </style>