File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,19 @@ use tauri_plugin_store::StoreExt;
66pub async fn resolve_setup ( app : & mut App ) -> Result < ( ) , Error > {
77 let args: Vec < String > = std:: env:: args ( ) . collect ( ) ;
88 println ! ( "Application started with arguments: {:?}" , args) ;
9+ // 将参数转成查询参数格式
10+ let query_params = args
11+ . iter ( )
12+ . map ( |arg| arg. split ( '=' ) . collect :: < Vec < & str > > ( ) )
13+ . collect :: < Vec < Vec < & str > > > ( ) ;
14+ println ! ( "query_params: {:?}" , query_params) ;
915 let app_handle = app. handle ( ) ;
1016 // 示例 JSON 字符串
1117 let window_json = r#"
1218 {
1319 "title": "PakePlus",
1420 "visible": false,
15- "url": "index.html?name=Tom&age=18",
21+ "url": "index.html?- name=Tom&-- age=18",
1622 "label": "main"
1723 }
1824 "# ;
Original file line number Diff line number Diff line change 1717 }
1818 // { name: "Tom", age: "18" } (例如 ?name=Tom&age=18)
1919 console . log ( 'queryParams' , queryParams )
20+ // 将 queryParams 转换为 JSON 字符串
21+ const queryParamsJson = JSON . stringify ( queryParams )
22+ console . log ( 'queryParamsJson' , queryParamsJson )
23+ // 将queryParamsJson 写入到root元素中显示
24+ window . addEventListener ( 'DOMContentLoaded' , ( ) => {
25+ const root = document . getElementById ( 'root' )
26+ root . innerHTML = queryParamsJson
27+ } )
2028 </ script >
2129 </ head >
2230 < body >
You can’t perform that action at this time.
0 commit comments