Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
ed00f181
提交
ed00f181
authored
8月 15, 2023
作者:
test
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 优化窗口最大化和还原交互
上级
cacb2e38
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
34 行增加
和
9 行删除
+34
-9
handler.ts
src-electron/main/handler.ts
+8
-0
Header.vue
src/views/main/components/Header.vue
+26
-9
没有找到文件。
src-electron/main/handler.ts
浏览文件 @
ed00f181
...
...
@@ -38,6 +38,14 @@ export async function useHandler(win: BrowserWindow, store: ElectronStore<Settin
}
})
win
.
on
(
'maximize'
,
()
=>
{
win
.
webContents
.
send
(
'window:action'
,
'max'
)
})
win
.
on
(
'unmaximize'
,
()
=>
{
win
.
webContents
.
send
(
'window:action'
,
'unmax'
)
})
// 设置窗口是否总在最前
if
(
store
.
get
(
'system.alwaysOnTop'
))
{
win
.
setAlwaysOnTop
(
true
)
...
...
src/views/main/components/Header.vue
浏览文件 @
ed00f181
...
...
@@ -13,6 +13,7 @@
const
isDebug
=
computed
(()
=>
clientStore
.
system
?.
debug
)
const
isAlwaysOnTop
=
computed
(()
=>
clientStore
.
system
?.
alwaysOnTop
)
const
isMaximized
=
ref
<
boolean
>
(
false
)
const
title
=
ref
<
string
>
(
$app
.
description
)
const
[
aboutRegister
,
{
openModal
:
openAboutModal
}]
=
useModal
()
const
[
settingRegister
,
{
openModal
:
openSettingModal
}]
=
useModal
()
...
...
@@ -29,9 +30,12 @@
if
(
action
===
'top'
)
{
clientStore
.
setAlwaysOnTop
(
!
isAlwaysOnTop
.
value
)
}
else
if
(
action
===
'max'
)
{
isMaximized
.
value
=
!
isMaximized
.
value
}
ipc
.
invoke
(
'window:action'
,
action
)
getCurrentInstance
().
proxy
.
$forceUpdate
()
}
function
about
()
{
...
...
@@ -70,6 +74,12 @@
}
},
)
ipc
.
on
(
'window:action'
,
(
_
,
action
:
'max'
|
'unmax'
|
string
)
=>
{
if
(
action
===
'max'
||
action
===
'unmax'
)
{
isMaximized
.
value
=
action
===
'max'
}
})
})
</
script
>
...
...
@@ -82,16 +92,16 @@
<div
class=
"title-text"
>
{{
title
}}
</div>
</a-space>
<a-space
class=
"btns"
>
<a-tooltip
title=
"重新加载"
v-if=
"isDebug"
>
<a-button
type=
"text"
primary
@
click=
"handleAction('reload')"
>
<Icon
icon=
"ant-design:reload-outlined"
:size=
"22"
/>
</a-button>
</a-tooltip>
<a-tooltip
title=
"调试"
v-if=
"isDebug"
>
<a-button
type=
"text"
primary
@
click=
"handleAction('debug')"
>
<Icon
icon=
"ant-design:bug-outlined"
:size=
"22"
/>
</a-button>
</a-tooltip>
<a-tooltip
title=
"重新加载"
v-if=
"isDebug"
>
<a-button
type=
"text"
primary
@
click=
"handleAction('reload')"
>
<Icon
icon=
"material-symbols:reopen-window-sharp"
:size=
"22"
/>
</a-button>
</a-tooltip>
<a-tooltip
title=
"应用设置"
>
<a-button
type=
"text"
primary
@
click=
"setting"
>
<Icon
icon=
"uil:setting"
:size=
"22"
/>
...
...
@@ -113,12 +123,19 @@
</a-tooltip>
<a-tooltip
title=
"最小化"
>
<a-button
type=
"text"
primary
@
click=
"handleAction('min')"
>
<Icon
icon=
"
ant-design:minus-outlined"
:size=
"22
"
/>
<Icon
icon=
"
material-symbols:chrome-minimize-sharp"
:size=
"24
"
/>
</a-button>
</a-tooltip>
<a-tooltip
title=
"缩放"
>
<a-button
type=
"text"
primary
@
click=
"handleAction('max')"
>
<Icon
icon=
"uil:window-maximize"
:size=
"22"
/>
<a-tooltip>
<a-button
type=
"text"
primary
@
click=
"handleAction('max')"
:title=
"isMaximized ? '还原' : '最大化'"
>
<Icon
:icon=
"
isMaximized
? 'material-symbols:chrome-restore-outline-sharp'
: 'material-symbols:chrome-maximize-outline-sharp'
"
:size=
"24"
/>
</a-button>
</a-tooltip>
<a-tooltip
title=
"关闭应用"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论