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