当前位置: 首页 > wzjs >正文

图书馆网站建设工作模板网站和定制网站

图书馆网站建设工作,模板网站和定制网站,泰安优化公司,视频服务器注入js脚本最常用的就是initialization_script,通过这个方法注入的js脚本在页面每个页面都会执行,这个在tauri文档也可以搜到:WebviewWindowBuilder in tauri::webview - Rust,但是请注意,这个方法只能用在WindowBuild…

注入js脚本最常用的就是initialization_script,通过这个方法注入的js脚本在页面每个页面都会执行,这个在tauri文档也可以搜到:WebviewWindowBuilder in tauri::webview - Rust,但是请注意,这个方法只能用在WindowBuilder::new方法后面,不能在启动的时候用在main窗口里面。main窗口可以通过eval来实现注入一次性的js脚本,但是当页面切换或者刷新的时候,就不会再次执行了。

you can only use initialization_script if you create the window in rust (via WebviewWindowBuilder). If you want to keep the rest of the config in tauri.conf.json you can set create: false and use https://docs.rs/tauri/latest/tauri/webview/struct.WebviewWindowBuilder.html#method.from_config

如果是非常想在main页面加载js脚本,有一个变相的方式:

就是使用这种方式:

mod command;
use serde_json::json;
use tauri::{menu::*, WindowEvent};
use tauri_plugin_store::StoreExt;#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {tauri::Builder::default().menu(|handle| {let menu = Menu::with_items(handle,&[#[cfg(target_os = "macos")]&Submenu::with_items(handle,"Edit",true,&[&PredefinedMenuItem::undo(handle, None)?,&PredefinedMenuItem::redo(handle, None)?,&PredefinedMenuItem::cut(handle, None)?,&PredefinedMenuItem::copy(handle, None)?,&PredefinedMenuItem::paste(handle, None)?,&PredefinedMenuItem::select_all(handle, None)?,],)?,],);menu}).plugin(tauri_plugin_opener::init()).plugin(tauri_plugin_os::init()).plugin(tauri_plugin_fs::init()).plugin(tauri_plugin_shell::init()).plugin(tauri_plugin_dialog::init()).plugin(tauri_plugin_http::init()).plugin(tauri_plugin_clipboard_manager::init()).plugin(tauri_plugin_store::Builder::default().build()).setup(|app| {let app_handle = app.handle();let main_window = tauri::WebviewWindowBuilder::from_config(app_handle,&app.config().app.windows.get(0).unwrap().clone(),).unwrap().initialization_script(include_str!("./extension/event.js")).initialization_script(include_str!("./extension/custom.js")).build().unwrap();let store = app.store("app_data.json")?;let window_size: Option<serde_json::Value> = store.get("window_size");if let Some(window_size) = window_size {let size = window_size.as_object().unwrap();let width = size["width"].as_f64().unwrap();let height = size["height"].as_f64().unwrap();// println!("window size init: {:?}", size);main_window.set_size(tauri::PhysicalSize::new(width, height)).unwrap();}main_window.on_window_event(move |event| {if let WindowEvent::Resized(size) = event {// println!("window resized: {:?}", size);let _ = store.set("window_size",json!({"width": size.width,"height": size.height}),);}});Ok(())}).run(tauri::generate_context!()).expect("error while running tauri application");
}


文章转载自:

http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://00000000.gkjyg.cn
http://www.dtcms.com/wzjs/602339.html

相关文章:

  • 大连科技学院官方网站的建设与放自己做的网站怎么实现结算功能
  • 用dz做网站怎么设置数据库wordpress 做用户登录
  • 长沙本地招聘网最新招聘信息aso优化服务站
  • 做外卖有哪些网站有哪些商城网站如何建设方案
  • 比较好的网页模板网站做网站生意多吗
  • 东莞企业网站青岛网站建设迅优
  • 橙色短信网站模板长春网站优化页面
  • thinkphp5做网站网站怎样做 文件签收
  • 礼泉做网站网站商城与网站区别吗
  • 个人网站设计规划现在装修流行什么样的风格
  • 建网站能在家里做吗新乡个人网站建设
  • html教学网站官方网站的网络营销功能分析
  • 在百度做网站需要什么资料网页设计图片在左文字在右
  • 天猫运营培训四川网站建设seo
  • 网站开发怎么设置打印按钮沈阳网站建设制作
  • 网站安装出现dir网站引导页一般是什么格式
  • 做红k线网站成都网站制作报价
  • 网站集约化建设要求工商局官网查询营业执照
  • django可以做多大的网站长沙工商注册流程
  • 响应式企业网站模板手机网站模板更改
  • 余姚做网站公司长沙圭塘网站建设公司
  • 济南专业网站建设哪家便宜上海网站设计价
  • 领诺科技网站建设十大免费货源网站免费版权
  • 建立网站要花多少钱昆山网站建设苦瓜
  • 网站建设投标书怎么制作郑州网站优化公司价位
  • 做网站备案须知外链图片
  • 做网站和做网店哪个好网站做蜘蛛池有用吗
  • 网站建设实习生怎么样为什么这么多人嫌弃top域名
  • 网站权限怎么设置方法网站建设企业服务商
  • 制作企业网站的秘诀搜索引擎 网站推广