refactor: react router (#5073)

* refactor: react router

* chore: update

* fix: router

* refactor: generate router children by navItems

* chore: set start page when create window

* docs: update UPDATELOG.md
This commit is contained in:
oomeow
2025-10-18 20:25:31 +08:00
committed by GitHub
parent 8e20b1b0a0
commit 96ce529b16
16 changed files with 74 additions and 115 deletions

View File

@@ -1,6 +1,7 @@
use tauri::WebviewWindow;
use crate::{
config::Config,
core::handle,
logging_error,
utils::{
@@ -17,13 +18,19 @@ const MINIMAL_WIDTH: f64 = 520.0;
const MINIMAL_HEIGHT: f64 = 520.0;
/// 构建新的 WebView 窗口
pub fn build_new_window() -> Result<WebviewWindow, String> {
pub async fn build_new_window() -> Result<WebviewWindow, String> {
let app_handle = handle::Handle::app_handle();
let start_page = Config::verge()
.await
.latest_ref()
.start_page
.clone()
.unwrap_or("/".to_string());
match tauri::WebviewWindowBuilder::new(
app_handle,
"main", /* the unique window label */
tauri::WebviewUrl::App("index.html".into()),
tauri::WebviewUrl::App(start_page.into()),
)
.title("Clash Verge")
.center()

View File

@@ -328,7 +328,7 @@ impl WindowManager {
return false;
}
match build_new_window() {
match build_new_window().await {
Ok(_) => {
logging!(info, Type::Window, "新窗口创建成功");
}