mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
fix(components/Titlebar): 还原/最大化按钮在双击标题栏时不会更新的问题 (#1575)
* fix(components/Titlebar): `还原/最大化`按钮在双击标题栏时不会更新的问题 * update
This commit is contained in:
parent
c85af59b21
commit
a9b05d66a6
4 changed files with 17 additions and 15 deletions
|
|
@ -332,6 +332,14 @@ class Background {
|
||||||
this.store.set('window', this.window.getBounds());
|
this.store.set('window', this.window.getBounds());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.window.on('maximize', () => {
|
||||||
|
this.window.webContents.send('isMaximized', true);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.window.on('unmaximize', () => {
|
||||||
|
this.window.webContents.send('isMaximized', false);
|
||||||
|
});
|
||||||
|
|
||||||
this.window.webContents.on('new-window', function (e, url) {
|
this.window.webContents.on('new-window', function (e, url) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
log('open url');
|
log('open url');
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@
|
||||||
<div
|
<div
|
||||||
class="button max-restore codicon"
|
class="button max-restore codicon"
|
||||||
:class="{
|
:class="{
|
||||||
'codicon-chrome-restore': !isShowMaximized,
|
'codicon-chrome-restore': isMaximized,
|
||||||
'codicon-chrome-maximize': isShowMaximized,
|
'codicon-chrome-maximize': !isMaximized,
|
||||||
}"
|
}"
|
||||||
@click="windowMaxRestore"
|
@click="windowMaxRestore"
|
||||||
></div>
|
></div>
|
||||||
|
|
@ -40,7 +40,7 @@ export default {
|
||||||
name: 'LinuxTitlebar',
|
name: 'LinuxTitlebar',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isShowMaximized: true,
|
isMaximized: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -49,9 +49,7 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
if (process.env.IS_ELECTRON === true) {
|
if (process.env.IS_ELECTRON === true) {
|
||||||
ipcRenderer.on('isMaximized', (_, value) => {
|
ipcRenderer.on('isMaximized', (_, value) => {
|
||||||
// 当窗口最大化时,value为false
|
this.isMaximized = value;
|
||||||
// 当窗口还原时,value为true
|
|
||||||
this.isShowMaximized = value;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
<div
|
<div
|
||||||
class="button max-restore codicon"
|
class="button max-restore codicon"
|
||||||
:class="{
|
:class="{
|
||||||
'codicon-chrome-restore': !isShowMaximized,
|
'codicon-chrome-restore': isMaximized,
|
||||||
'codicon-chrome-maximize': isShowMaximized,
|
'codicon-chrome-maximize': !isMaximized,
|
||||||
}"
|
}"
|
||||||
@click="windowMaxRestore"
|
@click="windowMaxRestore"
|
||||||
></div>
|
></div>
|
||||||
|
|
@ -37,7 +37,7 @@ export default {
|
||||||
name: 'Win32Titlebar',
|
name: 'Win32Titlebar',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isShowMaximized: true,
|
isMaximized: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -46,9 +46,7 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
if (process.env.IS_ELECTRON === true) {
|
if (process.env.IS_ELECTRON === true) {
|
||||||
ipcRenderer.on('isMaximized', (_, value) => {
|
ipcRenderer.on('isMaximized', (_, value) => {
|
||||||
// 当窗口最大化时,value为false
|
this.isMaximized = value;
|
||||||
// 当窗口还原时,value为true
|
|
||||||
this.isShowMaximized = value;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -222,9 +222,7 @@ export function initIpcMain(win, store, trayEventEmitter) {
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('maximizeOrUnmaximize', () => {
|
ipcMain.on('maximizeOrUnmaximize', () => {
|
||||||
const isMaximized = win.isMaximized();
|
win.isMaximized() ? win.unmaximize() : win.maximize();
|
||||||
isMaximized ? win.unmaximize() : win.maximize();
|
|
||||||
win.webContents.send('isMaximized', isMaximized);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('settings', (event, options) => {
|
ipcMain.on('settings', (event, options) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue