格式化与代码
SvelteKit 组件 + 页面生成器
+page.svelte, +page.server.ts and load functions in one go.
编辑注
Understanding · +page, +page.server, +layout — that's it.
本深度章节目前仅有英文版本。上方的转换工具支持您的语言;长篇说明文章尚未翻译。
常见问题
Quick answers.
›What is the difference between +page.ts and +page.server.ts?
`+page.ts` runs on both the server and the client for universal data fetching, while `+page.server.ts` only runs on the server. Use the server version for operations requiring private environment variables or direct database access.
›Are the generated files saved to my disk?
No. This tool generates the code text which you can then copy and paste into your local IDE. It does not have permission to modify your local filesystem directly.
›Does this support Svelte 5 snippets and runes?
Yes. You can toggle between legacy Svelte 4 syntax and the newer Svelte 5 runes including `$state` and `$derived` within the settings.
›Can I include TypeScript by default?
Yes. The generator defaults to TypeScript syntax for script blocks and load functions, but you can switch to plain JavaScript if your project requires it.
大家也在搜索
相关工具
More in this room.
- JSON 转 React Hook Form + Zod根据 JSON 结构生成类型化的表单 schema 和 useForm hook。
- JSON 转 Next.js Server Action带有 Zod 解析和 revalidatePath 的 Server Action。
- JSON 转 Prisma Schema Model从 JSON 示例生成 Prisma 模型块。
- JSON 转 Drizzle ORM SchemaDrizzle pgTable 定义,带有 $inferSelect / $inferInsert。
- JSON 转 TypeORM Entity带有装饰器和生成的 id 的 TypeORM @Entity 类。
- JSON 转 Mongoose Schema + Model带有时间戳和类型的 Mongoose Schema + 模型。