perf: 客户端标题优化

This commit is contained in:
kuaifan 2021-12-30 14:18:25 +08:00
parent b97a2e7cf3
commit bcf6cc1019
3 changed files with 24 additions and 5 deletions

21
electron/main.js vendored
View File

@ -66,7 +66,13 @@ function createMainWindow() {
})
}
mainWindow.on('close', function (e) {
mainWindow.on('page-title-updated', (event, title) => {
if (title == "index.html") {
event.preventDefault()
}
})
mainWindow.on('close', (e) => {
if (!willQuitApp) {
e.preventDefault();
if (inheritClose) {
@ -103,6 +109,10 @@ function createSubWindow(args) {
return;
}
} else {
let config = args.config || {};
if (typeof args.title !== "undefined") {
config.title = args.title;
}
browser = new BrowserWindow(Object.assign({
width: 1280,
height: 800,
@ -115,8 +125,13 @@ function createSubWindow(args) {
nodeIntegration: true,
contextIsolation: false
}
}, args.config || {}))
browser.on('close', function () {
}, config))
browser.on('page-title-updated', (event, title) => {
if (title == "index.html" || args.titleFixed === true) {
event.preventDefault()
}
})
browser.on('close', () => {
let index = subWindow.findIndex(item => item.name == name);
if (index > -1) {
subWindow.splice(index, 1)

View File

@ -1187,6 +1187,8 @@ export default {
config.minHeight = 600;
}
this.$Electron.ipcRenderer.send('windowRouter', {
title: this.taskDetail.name,
titleFixed: true,
name: 'task-' + this.taskDetail.id,
path: "/single/task/" + this.taskDetail.id,
force: false,

View File

@ -762,13 +762,15 @@ export default {
openSingle(item) {
this.$Electron.ipcRenderer.send('windowRouter', {
title: item.name,
titleFixed: true,
name: 'file-' + item.id,
path: "/single/file/" + item.id,
force: false, //
config: {
parent: null,
width: Math.min(window.screen.availWidth, 1280),
height: Math.min(window.screen.availHeight, 800),
width: Math.min(window.screen.availWidth, 1440),
height: Math.min(window.screen.availHeight, 900),
}
});
},