Loading...
Loading...
Compare original and translation side by side
---
// Server-side code (Frontmatter) runs at build/request time
const data = await fetch('https://api.myjson.com').then(r => r.json());
---
<html>
<body>
<h1>{data.title}</h1>
<!-- Client Directive: This React component hydrates on load -->
<MyReactComponent client:load />
<!-- This Svelte component hydrates only when visible -->
<MySvelteComponent client:visible />
</body>
</html>---
// 服务端代码(Frontmatter)在构建/请求时运行
const data = await fetch('https://api.myjson.com').then(r => r.json());
---
<html>
<body>
<h1>{data.title}</h1>
<!-- 客户端指令:该React组件在加载时进行水合 -->
<MyReactComponent client:load />
<!-- 该Svelte组件仅在可见时进行水合 -->
<MySvelteComponent client:visible />
</body>
</html>const blogCollection = defineCollection({
schema: z.object({ title: z.string(), date: z.date() }),
});const blogCollection = defineCollection({
schema: z.object({ title: z.string(), date: z.date() }),
});<Image /><Image />