在最外的app.vue或者index.vue的js模块编写
let refdade = ref(1);
//刷新,获得请求
// 获取完整的查询字符串(例如: "?dade=/myms")
const searchParams = new URLSearchParams(window.location.search);
// 获取 dade 参数的值(自动处理编码)
const dadeValue = searchParams.get('dade');
console.log('dade 参数的值:', dadeValue); // 输出: "/myms"
if(dadeValue && dadeValue !="/" && dadeValue != undefined){
// 跳转
router.push(dadeValue);
}else{
refdade.value = 2;
}
electron文件
const { app, BrowserWindow,ipcMain } = require('electron');
const path = require('path');
let secondWindow;
function setWin() {
ipcMain.on('setWins', (event, data) => {
console.log(data)
// 创建第二个窗口
secondWindow = new BrowserWindow({
width: data.width,
height: data.height,
autoHideMenuBar: true, // 自动隐藏菜单
title:data.title,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
// secondWindow.loadURL("http://127.0.0.1:8600/#"+data.url);
const indexHtmlUrl = `file://${path.join(__dirname, '../dist', 'index.html')}?dade=${data.url}`;
secondWindow.loadURL(indexHtmlUrl);
secondWindow.on('closed', function () {
secondWindow = null;
});
})
}
module.exports = {
setWin
};