Tauri:如何在单击菜单时打开网页

Gui*_*ion 5 rust tauri

我正在尝试制作一个小型金牛座应用程序,每个页面顶部都有相同的菜单。我按照本教程的“将菜单添加到所有窗口”部分进行操作。我可以看到菜单,我可以用它退出应用程序,但我不知道如何在点击时转到另一个 hmtl 页面。

我有这段代码,但我不知道在“accel”下放什么

.on_menu_event(|event| {
      match event.menu_item_id() {
        "quit" => {
          std::process::exit(0);
        }
        "close" => {
          event.window().close().unwrap();
          
        }
        "accel" => {
          //not working, as you can imagine
          //tauri::WindowUrl::App("index.html".into());
          //I would like tauri to display index.html in the main window
        }
        _ => {}
      }
    })
Run Code Online (Sandbox Code Playgroud)

有人知道如何做到这一点吗?我找到了几十个带有菜单的示例代码,但没有一个显示我正在寻找的内容(或者我无法指出我需要的行)

感谢您的帮助 !

Gui*_*ion 3

我终于从tauri不和谐聊天中得到了答案,我希望它对某人有用?

window.eval("window.location.replace('your.url')"); 完成了这份工作