perf: 客户端标题优化
This commit is contained in:
parent
b97a2e7cf3
commit
bcf6cc1019
21
electron/main.js
vendored
21
electron/main.js
vendored
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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),
|
||||
}
|
||||
});
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user