切换导航条
切换导航条
当前项目
正在载入...
登录
术习电报
/
electron-vue-template
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
作者
张恒
2019-11-05 18:18:31 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
提交
ad8ce70fc49f8bc9b53954a0fbfce9bf8485dcfd
ad8ce70f
1 个父辈
98dcfeda
小幅度修改小毛病
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
27 行增加
和
20 行删除
src/main/config/menu.js
src/main/index.js
src/main/services/windowManager.js
src/main/config/menu.js
查看文件 @
ad8ce70
...
...
@@ -17,10 +17,6 @@ const menu = [
},
{
label
:
'帮助'
,
submenu
:
[{
label
:
'切换到开发者模式'
,
accelerator
:
'CmdOrCtrl+I'
,
role
:
'toggledevtools'
},
{
label
:
'关于'
,
role
:
'about'
,
click
:
function
()
{
...
...
src/main/index.js
查看文件 @
ad8ce70
...
...
@@ -2,20 +2,10 @@
import
{
app
}
from
'electron'
import
initWindow
from
'./services/windowManager'
import
path
from
'path'
import
DisableButton
from
'./config/DisableButton'
/**
* Set `__static` path to static files in production
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
*/
if
(
process
.
env
.
NODE_ENV
!==
'development'
)
{
global
.
__static
=
path
.
join
(
__dirname
,
'/static'
).
replace
(
/
\\
/g
,
'\\\\'
)
}
const
loadingURL
=
process
.
env
.
NODE_ENV
===
'development'
?
'http://localhost:9080/static/loader.html'
:
`file://
${
__static
}
/loader.html`
function
onAppReady
()
{
initWindow
(
loadingURL
)
initWindow
()
DisableButton
.
Disablef12
()
}
...
...
src/main/services/windowManager.js
查看文件 @
ad8ce70
...
...
@@ -4,8 +4,18 @@ import config from '@config'
import
setIpc
from
'./ipcMain'
import
electronDevtoolsInstaller
,
{
VUEJS_DEVTOOLS
}
from
'electron-devtools-installer'
import
upload
from
'./checkupdate'
import
path
from
'path'
/**
* Set `__static` path to static files in production
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
*/
// 这个瓜皮全局变量只能在单个js中生效,而并不是整个主进程中
if
(
process
.
env
.
NODE_ENV
!==
'development'
)
{
global
.
__static
=
path
.
join
(
__dirname
,
'/static'
).
replace
(
/
\\
/g
,
'\\\\'
)
}
// 将文件地址挪到这里
const
winURL
=
process
.
env
.
NODE_ENV
===
'development'
?
'http://localhost:9080'
:
`file://
${
__dirname
}
/index.html`
const
loadingURL
=
process
.
env
.
NODE_ENV
===
'development'
?
'http://localhost:9080/static/loader.html'
:
`file://
${
__static
}
/loader.html`
var
loadWindow
=
null
var
mainWindow
=
null
...
...
@@ -30,7 +40,18 @@ function createMainWindow () {
scrollBounce
:
process
.
platform
===
'darwin'
}
})
// 这里设置只有开发环境才注入显示开发者模式
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
menuconfig
.
push
({
label
:
'开发者设置'
,
submenu
:
[{
label
:
'切换到开发者模式'
,
accelerator
:
'CmdOrCtrl+I'
,
role
:
'toggledevtools'
}]
})
}
// 载入菜单
const
menu
=
Menu
.
buildFromTemplate
(
menuconfig
)
Menu
.
setApplicationMenu
(
menu
)
mainWindow
.
loadURL
(
winURL
)
...
...
@@ -58,7 +79,7 @@ function createMainWindow () {
})
}
function
loadindWindow
(
loadingURL
)
{
function
loadindWindow
()
{
loadWindow
=
new
BrowserWindow
({
width
:
400
,
height
:
600
,
...
...
@@ -77,9 +98,9 @@ function loadindWindow (loadingURL) {
},
2000
)
}
function
initWindow
(
loadingURL
)
{
function
initWindow
()
{
if
(
config
.
UseStartupChart
)
{
return
loadindWindow
(
loadingURL
)
return
loadindWindow
()
}
else
{
return
createMainWindow
()
}
...
...
请
注册
或
登录
后发表评论