Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
testMenu
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蔡芬
testMenu
Commits
4cc42abc
提交
4cc42abc
authored
3月 20, 2023
作者:
蔡芬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1
上级
f9ae78f4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
26 行增加
和
6 行删除
+26
-6
ipc.js
src/main/events/ipc.js
+7
-0
mainWindow.js
src/main/windows/mainWindow.js
+5
-3
App.vue
src/renderer/App.vue
+13
-3
main.js
src/renderer/main.js
+1
-0
没有找到文件。
src/main/events/ipc.js
浏览文件 @
4cc42abc
...
@@ -4,6 +4,8 @@ import { saveJson } from '@/libs/utils/backfunction.js';
...
@@ -4,6 +4,8 @@ import { saveJson } from '@/libs/utils/backfunction.js';
class
IpcEvents
{
class
IpcEvents
{
create
(
appManager
)
{
create
(
appManager
)
{
this
.
appManager
=
appManager
this
.
appManager
=
appManager
this
.
windowManager
=
appManager
.
windowManager
;
this
.
win
=
this
.
windowManager
.
mainWindow
.
win
;
/* 翻译器函数
/* 翻译器函数
Translator function */
Translator function */
...
@@ -44,6 +46,11 @@ class IpcEvents {
...
@@ -44,6 +46,11 @@ class IpcEvents {
menu
.
popup
(
BrowserWindow
.
fromWebContents
(
event
.
sender
))
menu
.
popup
(
BrowserWindow
.
fromWebContents
(
event
.
sender
))
});
});
ipcMain
.
on
(
"setMainWindow0"
,
(
e
,
data
)
=>
{
console
.
log
(
'data'
,
data
)
this
.
windowManager
.
mainWindow
.
win
.
setPosition
((
data
.
width
-
600
)
/
2
,(
data
.
height
-
80
))
})
}
}
}
}
...
...
src/main/windows/mainWindow.js
浏览文件 @
4cc42abc
import
{
BrowserWindow
,
Menu
,
app
,
globalShortcut
,
shell
}
from
'electron'
import
{
BrowserWindow
,
Menu
,
app
,
globalShortcut
,
shell
,
remote
}
from
'electron'
import
{
createProtocol
}
from
'vue-cli-plugin-electron-builder/lib'
import
{
createProtocol
}
from
'vue-cli-plugin-electron-builder/lib'
const
path
=
require
(
'path'
)
const
path
=
require
(
'path'
)
...
@@ -35,11 +35,11 @@ class MainWindow {
...
@@ -35,11 +35,11 @@ class MainWindow {
const
win
=
new
BrowserWindow
({
const
win
=
new
BrowserWindow
({
width
:
600
,
width
:
600
,
height
:
12
0
,
height
:
8
0
,
// fullscreen:true, //是否全屏显示
// fullscreen:true, //是否全屏显示
// fullscreenable:true,
// fullscreenable:true,
maxWidth
:
600
,
maxWidth
:
600
,
maxHeight
:
12
0
,
maxHeight
:
8
0
,
resizable
:
false
,
resizable
:
false
,
x
:
400
,
x
:
400
,
y
:
500
,
y
:
500
,
...
@@ -49,6 +49,8 @@ class MainWindow {
...
@@ -49,6 +49,8 @@ class MainWindow {
fullscreen
:
false
,
fullscreen
:
false
,
fullscreenable
:
false
,
fullscreenable
:
false
,
autoHideMenuBar
:
true
,
autoHideMenuBar
:
true
,
backgroundColor
:
'#00000000'
,
//透明颜色
transparent
:
true
,
//透明开启
// useContentSize: true,
// useContentSize: true,
webPreferences
:
{
webPreferences
:
{
/* 注意,这些设置有关程序的安全性,请谨慎使用!
/* 注意,这些设置有关程序的安全性,请谨慎使用!
...
...
src/renderer/App.vue
浏览文件 @
4cc42abc
...
@@ -14,7 +14,11 @@ export default {
...
@@ -14,7 +14,11 @@ export default {
created
()
{
created
()
{
},
},
mounted
()
{
mounted
()
{
const
screen
=
this
.
$electron
.
remote
.
screen
;
const
{
width
,
height
}
=
screen
.
getPrimaryDisplay
().
workAreaSize
;
//获取到屏幕的宽度和高度
console
.
log
(
'宽高'
,
width
,
height
);
let
ipcRenderer
=
this
.
$electron
&&
this
.
$electron
.
ipcRenderer
||
{};
ipcRenderer
.
send
(
"setMainWindow0"
,{
width
,
height
});
},
},
methods
:
{
methods
:
{
...
@@ -22,6 +26,9 @@ export default {
...
@@ -22,6 +26,9 @@ export default {
}
}
</
script
>
</
script
>
<
style
lang=
"less"
>
<
style
lang=
"less"
>
html {
background-color: transparent;
}
body {
body {
margin: 0;
margin: 0;
}
}
...
@@ -31,11 +38,14 @@ body {
...
@@ -31,11 +38,14 @@ body {
justify-content: space-evenly;
justify-content: space-evenly;
align-items: center;
align-items: center;
height: 100%;
height: 100%;
border-radius: 20px;
overflow: hidden;
background-color: hsl(0, 0%, 25%);
.img1 {
.img1 {
height:
12
0px;
height:
8
0px;
}
}
.img {
.img {
height:
9
0px;
height:
6
0px;
}
}
}
}
</
style
>
</
style
>
...
...
src/renderer/main.js
浏览文件 @
4cc42abc
...
@@ -18,6 +18,7 @@ import "vue-router-tab/dist/lib/vue-router-tab.css";
...
@@ -18,6 +18,7 @@ import "vue-router-tab/dist/lib/vue-router-tab.css";
// web不引入 以下在打包时不生效
// web不引入 以下在打包时不生效
// if (!!process.env.IS_ELECTRON) require("./styles/electron.less");
// if (!!process.env.IS_ELECTRON) require("./styles/electron.less");
if
(
isElectron
()
)
require
(
"./styles/electron.less"
);
if
(
isElectron
()
)
require
(
"./styles/electron.less"
);
if
(
!!
process
.
env
.
IS_ELECTRON
)
Vue
.
use
(
require
(
"./vue_electron.js"
));
import
{
import
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论