(window: Window) { // Close splashscreen window.get_window("splashscreen").expect("no window labeled 'splashscreen' found").close().unwrap(); // Show main window window.get_window("main").expect("no window labeled 'main' found").show().unwrap(); } fn main() { tauri::Builder::...
get_window("main").expect("no window labeled 'main' found").show().unwrap(); } 同时将close_splashscreen加入到tauri::Builder::default()的数组中, 完整rust代码: 代码语言:javascript 复制 // Prevents additional console window on Windows in release, DO NOT REMOVE!! #![cfg_attr(not(debug_...
AddedWindow::set_menu,Window::remove_menu,Window::show_menu,Window::hide_menu,Window::is_menu_visibleandWindow::menuto access, remove, hide or show the menu on this window. AddedWindow::popup_menuandWindow::popup_menu_atto show a context menu on the window at the cursor position or at ...
} if id == "hide" => { let window = app.get_window("main").unwrap(); window.hide().unwrap(); }, SystemTrayEvent::MenuItemClick { ref id, .. } if id == "show" => { let window = app.get_window("main").unwrap(); window.show().unwrap(); }, _ => {} } } fn mai...
window.get_window("main").unwrap().show().unwrap(); } fn main() { tauri::Builder::default() // 注册命令 .invoke_handler(tauri::generate_handler![close_splashscreen]) .run(tauri::generate_context!()) .expect("error while running tauri application"); ...
Thewindowallowlist now includes options to enable all window modification APIs:center,close,create,hide,maximize,minimize,print,requestUserAttention,setAlwaysOnTop,setDecorations,setFocus,setFullscreen,setIcon,setMaxSize,setMinSize,setPosition,setResizable,setSize,setSkipTaskbar,setTitle,show,startDragging,unmaxim...
02eaf0787(#9428) Fixes inner_size crash when the window has no webviews. f22ea2998(#9465) Revert the fix for webview's visibility doesn't change with the app window on Windows as it caused white flashes on show/restore.DependenciesUpgraded to tauri-utils@2.0.0-beta.12...
getTauriVersion: unit => Promise.t<string>getVersionGets the application version.getVersion: unit => Promise.t<string>hideHides the application on macOS.hide: unit => Promise.t<unit>showShows the application on macOS. This function does not automatically focus any specific app window....
use tauri::Manager; // 创建一个 Rust 命令 #[tauri::command] fn close_splashscreen(window: tauri::Window) { // 关闭启动视图 if let Some(splashscreen) = window.get_window("splashscreen") { splashscreen.close().unwrap(); } // 展示主视图 window.get_window("main").unwrap().show()....
// 监听自定义菜单事件 on_menu_event(|event| match event.menu_item_id() { "quit" => { // 逻辑自定义 std::process::exit(0); } "close" => { // 逻辑自定义 event.window().close().unwrap(); } _ => {} }) 通过on_menu_event方法监听自定义菜单项的触发事件,它接收的参数是一个闭...