From 1f5daab03fd29d2bdf1980704d191ad68f837675 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Sat, 16 Dec 2023 17:25:33 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/client.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/client.rs b/src-tauri/src/client.rs index bf683868..5e72cee7 100644 --- a/src-tauri/src/client.rs +++ b/src-tauri/src/client.rs @@ -68,16 +68,14 @@ pub async fn create_mhy_client(handle: AppHandle, func: String, url: String) { } "open_post" => { 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 arg = { method: 'teyvat_open', - payload: { - url: url - } + payload: url, } - window.__TAURI__.emit('post_mhy_client',JSON.stringify(arg)); - "#; + await window.__TAURI__.event.emit('post_mhy_client',JSON.stringify(arg)); + })()"#; window.eval(&execute_js).ok().unwrap(); } _ => {}