新增: Tauri 2.0 桌面版脚手架(B0)
- src-tauri/ 完整项目结构: Cargo.toml / build.rs / tauri.conf.json - Rust 入口 lib.rs: ping IPC 命令验证双向通信 - 应用图标生成(SVG → ico/icns/png 多尺寸) - Tauri 窗口配置: 1280×800, 最小 900×600, 可缩放 - package.json 新增 tauri / tauri:dev / tauri:build 脚本 - vite.config.ts 环境检测: Tauri 模式端口 5173, Web 模式 8080 - @tauri-apps/cli + @tauri-apps/api 依赖安装 - cargo check 编译通过,前端构建不受影响 - 桌面版与 Web 版共享同一套前端代码
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
/* =====================================================================
|
||||
* lib.rs — Tauri 应用入口(B0 脚手架)
|
||||
*
|
||||
* 当前阶段:Vue 前端原样跑在 WebView 里,Rust 端只有 ping 验证 IPC。
|
||||
* 后续 B1-B5 逐步迁移核心逻辑到 Rust。
|
||||
* ===================================================================== */
|
||||
|
||||
/// IPC 验证命令:前端 invoke('ping') → 返回 'pong'
|
||||
#[tauri::command]
|
||||
fn ping() -> String {
|
||||
"pong".to_string()
|
||||
}
|
||||
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![ping])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
fn main() {
|
||||
u_ppt_lib::run()
|
||||
}
|
||||
Reference in New Issue
Block a user