Skip to main content

概述

Svelte 是一个用于在 Web 上构建用户界面的框架。它使用编译器将用 HTML、CSS 和 JavaScript 编写的声明性组件转换为...

¥Svelte is a framework for building user interfaces on the web. It uses a compiler to turn declarative components written in HTML, CSS and JavaScript...

App
<script>
	function greet() {
		alert('Welcome to Svelte!');
	}
</script>

<button onclick={greet}>click me</button>

<style>
	button {
		font-size: 2em;
	}
</style>
<script lang="ts">
	function greet() {
		alert('Welcome to Svelte!');
	}
</script>

<button onclick={greet}>click me</button>

<style>
	button {
		font-size: 2em;
	}
</style>

...精简、紧密优化的 JavaScript。

¥...into lean, tightly optimized JavaScript.

你可以使用它在网络上构建任何东西,从独立组件到雄心勃勃的全栈应用(使用 Svelte 的配套应用框架 SvelteKit)以及介于两者之间的一切。

¥You can use it to build anything on the web, from standalone components to ambitious full stack apps (using Svelte’s companion application framework, SvelteKit) and everything in between.

这些页面用作参考文档。如果你是 Svelte 新手,我们建议你从 互动教程 开始,有问题时再回来这里。

¥These pages serve as reference documentation. If you’re new to Svelte, we recommend starting with the interactive tutorial and coming back here when you have questions.

你还可以在 playground 中在线试用 Svelte,或者,如果你需要功能更齐全的环境,可以在 StackBlitz 上试用。

¥You can also try Svelte online in the playground or, if you need a more fully-featured environment, on StackBlitz.

上一页 下一页