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. For a more detailed walk through, see Create a Project

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

在你创建了第一个应用之后,查看 项目结构 以了解每个文件的作用。

🌐 After you’ve created your first app, take a look at Project Structure to understand what each file does.

或者从示例中探索项目设置和功能(tauri | plugins-workspace

🌐 Or explore the project setups and features from the examples (tauri | plugins-workspace)

🌐 Why Tauri?

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

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

  • 构建应用的安全基础
  • 通过使用系统的原生 webview 来减小包大小
  • 开发者可以灵活地使用任何前端和多种语言的绑定

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

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

🌐 Secure Foundation

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

🌐 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 应用利用了每个用户系统上已经可用的网页视图。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 和 Rust 之间的绑定可通过 JavaScript 中的 invoke 函数供开发者使用,Swift 和 Kotlin 绑定可用于 Tauri 插件

🌐 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 负责网页视图的渲染。这些都是由 Tauri 维护的库,如果需要在 Tauri 暴露的功能之外进行更深入的系统集成,可以直接使用它们。

此外,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号
Nodejs.cn 旗下网站