Skip to content

文档头管理 ​

我们默认内置了 @unhead/vue v2 来方便地管理文档头部(document-head)。你可以直接在页面/组件中使用它。。

基本用法 ​

在任意组件中使用 useHead:

html
<template>
  <button @click="count++">Click</button>
</template>

<script setup>
import { useHead } from '@unhead/vue'

useHead({
  title: 'Website Title',
  meta: [
    {
      name: 'description',
      content: 'Website description',
    },
  ],
})
</script>

就是这样!无需任何配置。Vite SSG 会自动处理服务端渲染和合并

vite-ssg 中文文档,基于 VitePress 构建