Tauri 更新菜单项
2024-01-26 10:00 更新
Window
结构体有一个 方法,它允许更新菜单项:menu_handle
fn main() {
let menu = Menu::new(); // configure the menu
tauri::Builder::default()
.menu(menu)
.setup(|app| {
let main_window = app.get_window("main").unwrap();
let menu_handle = main_window.menu_handle();
std::thread::spawn(move || {
// you can also `set_selected`, `set_enabled` and `set_native_image` (macOS only).
menu_handle.get_item("item_id").set_title("New title");
});
Ok(())
})
}
以上内容是否对您有帮助:
更多建议: