Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
pptist
Commits
f0f1015b
Commit
f0f1015b
authored
May 27, 2024
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改弹窗规则
parent
894675de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
App.vue
src/App.vue
+16
-6
No files found.
src/App.vue
View file @
f0f1015b
...
...
@@ -27,9 +27,9 @@ onMounted(async () => {
snapshotStore
.
initSnapshotDatabase
()
mainStore
.
setAvailableFonts
()
})
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
window
.
onbeforeunload
=
()
=>
false
}
//
if (process.env.NODE_ENV === 'production') {
//
window.onbeforeunload = () => false
//
}
// 应用注销时向 localStorage 中记录下本次 indexedDB 的数据库ID,用于之后清除数据库
window
.
addEventListener
(
'unload'
,
()
=>
{
const
discardedDB
=
localStorage
.
getItem
(
LOCALSTORAGE_KEY_DISCARDED_DB
)
...
...
@@ -51,10 +51,20 @@ setInterval(() => {
healthCheckHandler
()
},
1000
*
60
)
onMounted
(
()
=>
{
onMounted
(()
=>
{
const
rules
=
[
'/editor/'
,
'/team_editor/'
,
'/manager_template/'
,
'/create_template/'
]
window
.
onbeforeunload
=
function
(
event
)
{
event
.
preventDefault
();
};
const
currentUrl
=
window
.
location
.
pathname
;
const
shouldShowWarning
=
rules
.
some
(
rule
=>
currentUrl
.
includes
(
rule
));
console
.
log
(
shouldShowWarning
)
if
(
shouldShowWarning
)
{
event
.
preventDefault
();
const
confirmationMessage
=
"你确定要离开这个页面吗?离开前注意检查是否已经保存"
;
event
.
returnValue
=
confirmationMessage
;
return
confirmationMessage
;
}
return
null
;
}
})
</
script
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment