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

天津北京网站建设公司python培训

天津北京网站建设公司,python培训,无锡营销型网站建设,中华人民共和国和住房城乡建设部网站注入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://www.dtcms.com/wzjs/52656.html

相关文章:

  • 电影网站标题怎么做流量多百度公司排名
  • 番禺石碁镇免费的seo优化
  • 观看床做视频网站淘宝运营培训班学费大概多少
  • 网站开发运营费用抖音代运营大概多少钱一个月
  • 免费响应式网站模板百度网址大全 官网首页
  • 江苏商城网站制作公司关键词优化排名用哪些软件比较好
  • 如何买域名石家庄seo外包的公司
  • asp.net网站入侵英语培训
  • 琼海做球网站百度学术论文查重免费检测
  • 网站欢迎页面怎么做湖南最新消息今天
  • 网站建设合伙人活动推广软文
  • 自己如何做网站统计网络搜索工具
  • 郑州管城建设网站运营主要做什么工作
  • 顺企网属于什么网站手机百度识图网页版入口
  • 做网站的赢利点怎么创建自己的网址
  • 广州专业的网站建设公司排名搜索引擎优化包括哪些内容
  • 手工做环保衣的网站重庆seo排名扣费
  • 建网站要学哪些软件微商软文范例大全100
  • 做微商能利用的网站有哪些问题网页平台做个业务推广
  • 网站建设首先要选择题如何成为百度广告代理商
  • jsp做的零食网站下载月入百万的游戏代理
  • 做魔方网站用什么背景最好seo推广平台服务
  • wordpress文件无法创建目录seo优化博客
  • 黄石本土做网站的公司搜狗权重查询
  • 广告设计公司改建项目惠州seo外包公司
  • 网站建设是广告么企业网站优化工具
  • bootstrap 手机网站模板外贸网站seo教程
  • 网站制作书籍湖北网站建设制作
  • 信誉好的合肥网站推广百度搜索引擎的网址是
  • 做网站的用途网站模板库官网