tauri2中创建新的窗口方式,和tauri1不一样了哦

看官方javascript的api文档:window | Tauri

tauri中的rust文档:https://docs.rs/tauri/latest/tauri/index.html

tauri.config.json定义文档:Configuration | Tauri

tauri可用插件:tauri-apps repositories · GitHub

在前端页面创建窗口示例:

javascript 复制代码
import { Window } from "@tauri-apps/api/window"

const appWindow = new Window('theUniqueLabel');

appWindow.once('tauri://created', function () {
 // window successfully created
});
appWindow.once('tauri://error', function (e) {
 // an error happened creating the window
});

// emit an event to the backend
await appWindow.emit("some-event", "data");
// listen to an event from the backend
const unlisten = await appWindow.listen("event-name", e => {});
unlisten();

在tauri后端rust创建窗口文档:WebviewWindowBuilder in tauri::webview - Rust

示例代码:

rust 复制代码
#[tauri::command]
async fn create_window(app: tauri::AppHandle) {
  let webview_window = tauri::WebviewWindowBuilder::new(&app, "label", tauri::WebviewUrl::App("index.html".into()))
    .build()
    .unwrap();
}
相关推荐
bloglin999991 天前
scp、rsync远程文件同步
linux·运维·服务器
迦南的迦 亚索的索1 天前
LINUX环境
linux·运维·服务器
yuanjj881 天前
linux下调试域格CLM920 NC5等9x07平台模块 QMI拨号
linux·运维·服务器
懂懂tty1 天前
React状态更新流程
前端·react.js
IMPYLH1 天前
Linux 的 printenv 命令
linux·运维·服务器·bash
SilentSamsara1 天前
SSH 远程管理:密钥登录 + 隧道转发,一次性配置好
linux·运维·服务器·ubuntu·centos·ssh
小码哥_常1 天前
告别繁琐!手把手教你封装超实用Android原生Adapter基类
前端
HoneyMoose1 天前
Jenkins Cloudflare 部署提示错误
java·servlet·jenkins
阿丰资源1 天前
基于SpringBoot的物流信息管理系统设计与实现(附资料)
java·spring boot·后端
skywalk81631 天前
pytest测试的时候这是什么意思?Migrating <class ‘kotti.resources.File‘>
前端·python