Skip to content
Tauri 中文网

什么是 Tauri?

Tauri 是一个用于为所有主要桌面和移动平台构建微型、快速二进制文件的框架。开发者可以集成任何编译为 HTML、JavaScript 和 CSS 的前端框架来构建用户体验,同时在需要时利用 Rust、Swift 和 Kotlin 等语言实现后端逻辑。

¥Tauri is a framework for building tiny, fast binaries for all major desktop and mobile platforms. Developers can integrate any frontend framework that compiles to HTML, JavaScript, and CSS for building their user experience while leveraging languages such as Rust, Swift, and Kotlin for backend logic when needed.

使用以下命令之一开始使用 create-tauri-app 进行构建。请务必按照 先决条件指南 安装 Tauri 所需的所有依赖,然后查看 前端配置指南 以获取推荐的前端配置。

¥Get started building with create-tauri-app by using one of the below commands. Be sure to follow the prerequisites guide to install all of the dependencies required by Tauri and then view the Frontend Configuration guides for recommended frontend configurations.

sh <(curl https://create.tauri.app/sh)

创建第一个应用后,你可以在 功能和秘诀列表 中探索 Tauri 的不同功能和秘诀。

¥After you’ve created your first app you can explore the different features and recipes of Tauri in the List of Features & Recipes.

为什么是 Tauri?

¥Why Tauri?

Tauri 有 3 个主要优势可供开发者构建:

¥Tauri has 3 main advantages for developers to build upon:

  • 构建应用的安全基础

    ¥Secure foundation for building apps

  • 通过使用系统的原生 webview 来减小包大小

    ¥Smaller bundle size by using the system’s native webview

  • 开发者可以灵活地使用任何前端和多种语言的绑定

    ¥Flexibility for developers to use any frontend and bindings for multiple languages

了解有关 Tauri 1.0 博客文章 中 Tauri 哲学的更多信息。

¥Learn more about the Tauri philosophy in the Tauri 1.0 blog post.

安全基础

¥Secure Foundation

通过基于 Rust 构建,Tauri 能够利用 Rust 提供的内存、线程和类型安全。基于 Tauri 构建的应用可以自动获得这些好处,甚至无需由 Rust 专家开发。

¥By being built on Rust, Tauri is able to take advantage of the memory, thread, and type-safety offered by Rust. Apps built on Tauri can automatically get those benefits even without needing to be developed by Rust experts.

Tauri 还对主要和次要版本进行了安全审核。这不仅涵盖 Tauri 组织中的代码,还涵盖 Tauri 所依赖的上游依赖。当然,这并不能减轻所有风险,但它为开发者提供了坚实的基础。

¥Tauri also undergoes a security audit for major and minor releases. This not only covers code in the Tauri organization, but also for upstream dependencies that Tauri relies on. Of course this doesn’t mitigate all risks, but it provides a solid foundation for developers to build on top of.

阅读 Tauri 安全政策Tauri 2.0 审计报告

¥Read the Tauri security policy and the Tauri 2.0 audit report.

更小的应用大小

¥Smaller App Size

Tauri 应用利用每个用户系统上已有的 Web 视图。Tauri 应用仅包含特定于该应用的代码和资源,不需要将浏览器引擎与每个应用打包在一起。这意味着最小的 Tauri 应用的大小可以小于 600KB。

¥Tauri apps take advantage of the web view already available on every user’s system. A Tauri app only contains the code and assets specific for that app and doesn’t need to bundle a browser engine with every app. This means that a minimal Tauri app can be less than 600KB in size.

了解有关在 应用大小概念 中创建优化应用的更多信息。

¥Learn more about creating optimized apps in the App Size concept.

灵活的架构

¥Flexible Architecture

由于 Tauri 使用 Web 技术,这意味着几乎任何前端框架都与 Tauri 兼容。前端配置指南 包含流行前端框架的通用配置。

¥Since Tauri uses web technologies that means that virtually any frontend framework is compatible with Tauri. The Frontend Configuration guide contains common configurations for popular frontend frameworks.

开发者可以使用 JavaScript 中的 invoke 函数实现 JavaScript 和 Rust 之间的绑定,并且 Tauri 插件 可以使用 Swift 和 Kotlin 绑定。

¥Bindings between JavaScript and Rust are available to developers using the invoke function in JavaScript and Swift and Kotlin bindings are available for Tauri Plugins.

TAO 负责 Tauri 窗口创建,WRY 负责 Web 视图渲染。这些是 Tauri 维护的库,如果需要在 Tauri 公开的内容之外进行更深层次的系统集成,可以直接使用。

¥TAO is responsible for Tauri window creation and WRY is responsible for web view rendering. These are libraries maintained by Tauri and can be consumed directly if deeper system integration is required outside of what Tauri exposes.

此外,Tauri 还维护了许多插件来扩展 Tauri 核心公开的内容。你可以在 插件部分 中找到这些插件以及社区提供的插件。

¥In addition, Tauri maintains a number of plugins to extend what core Tauri exposes. You can find those plugins alongside those provided by the community in the Plugins section.


Tauri 中文网 - 粤ICP备13048890号