Leptos
Leptos 是一个基于 Rust 的 Web 框架。你可以在 Leptos 的 官方网站 上阅读有关其的更多信息。本指南适用于 Leptos 0.6 版。
¥Leptos is a Rust based web framework. You can read more about Leptos on their official website. This guide is accurate as of Leptos version 0.6.
检查清单
¥Checklist
-
使用 SSG,Tauri 不正式支持基于服务器的解决方案。
¥Use SSG, Tauri doesn’t officially support server based solutions.
-
使用
serve.ws_protocol = "ws"
以便热重载 websocket 可以正确连接以进行移动开发。¥Use
serve.ws_protocol = "ws"
so that the hot-reload websocket can connect properly for mobile development. -
启用
withGlobalTauri
以确保 Tauri API 在window.__TAURI__
变量中可用,并且可以使用wasm-bindgen
导入。¥Enable
withGlobalTauri
to ensure that Tauri APIs are available in thewindow.__TAURI__
variable and can be imported usingwasm-bindgen
.
示例配置
¥Example Configuration
-
Update Tauri configuration
src-tauri/tauri.conf.json {"build": {"beforeDevCommand": "trunk serve","devUrl": "http://localhost:1420","beforeBuildCommand": "trunk build","frontendDist": "../dist"},"app": {"withGlobalTauri": true}} -
Update Trunk configuration
Trunk.toml [build]target = "./index.html"[watch]ignore = ["./src-tauri"][serve]port = 1420open = falsews_protocol = "ws"
Tauri 中文网 - 粤ICP备13048890号