陶里:点击菜单时如何打开网页



我正在尝试制作一个小的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
}
_ => {}
}
})

有人知道怎么做吗?我已经找到了十几个带有菜单的示例代码,但没有一个显示我想要的内容(或者我无法指出我需要的行(

谢谢你的帮助!

我终于从牛头人的不和聊天中得到了答案,我希望它能对某人有用吗?

window.eval("window.location.replace('your.url')");使工作成为

您必须在Cargo.toml中进行配置

tauri = { version = "x.y.z", features = [..., "shell-open"] }

最新更新