添加菜单项

This commit is contained in:
BTMuli
2023-12-16 17:25:33 +08:00
parent 154a9183bf
commit 1f5daab03f

View File

@@ -68,16 +68,14 @@ pub async fn create_mhy_client(handle: AppHandle, func: String, url: String) {
} }
"open_post" => { "open_post" => {
let window = handle.get_window("mhy_client").unwrap(); let window = handle.get_window("mhy_client").unwrap();
let execute_js = r#" let execute_js = r#"javascript:(async function(){
let url = window.location.href; let url = window.location.href;
let arg = { let arg = {
method: 'teyvat_open', method: 'teyvat_open',
payload: { payload: url,
url: url
} }
} await window.__TAURI__.event.emit('post_mhy_client',JSON.stringify(arg));
window.__TAURI__.emit('post_mhy_client',JSON.stringify(arg)); })()"#;
"#;
window.eval(&execute_js).ok().unwrap(); window.eval(&execute_js).ok().unwrap();
} }
_ => {} _ => {}