Head
管理文档 <head> 中的内容,支持 SSR。
Props
ts
interface HeadProps {
children: View | View[]
}| 属性 | 类型 | 说明 |
|---|---|---|
children | View | View[] | 要插入到 head 的内容 |
示例
tsx
import { Head } from 'vitarx'
function BlogPost(props: { title: string }) {
return (
<div>
<Head>
<title>{props.title}</title>
<meta name="description" content="Blog post" />
</Head>
<h1>{props.title}</h1>
</div>
)
}参考:Head 详解