Leptos
Leptos 是一个基于 Rust 的 Web 框架。您可以在他们的官方网站上了解更多关于 Leptos 的信息。本指南适用于 Leptos 的 0.6 版本。
检查清单
- 使用 SSG,Tauri 不支持基于服务器的解决方案。
- 使用
serve.ws_protocol = "ws"
以便进行移动开发时热重载 websocket 可以正常连接。 - 启用
withGlobalTauri
以确保 Tauri API 在使用window.__TAURI__
变量时可用,并且可以使用wasm-bindgen
导入。
示例配置
-
更新 Tauri 配置
src-tauri/tauri.conf.json {"build": {"beforeDevCommand": "trunk serve","devUrl": "http://localhost:1420","beforeBuildCommand": "trunk build","frontendDist": "../dist"},"app": {"withGlobalTauri": true}} -
更新 Trunk 配置
Trunk.toml [build]target = "./index.html"[watch]ignore = ["./src-tauri"][serve]port = 1420open = falsews_protocol = "ws"
© 2025 Tauri Contributors. CC-BY / MIT