pull/59/head
ruibaby 2019-11-07 12:17:36 +08:00
parent e0d568a8fe
commit a8c204661b
2 changed files with 40 additions and 2 deletions

View File

@ -120,6 +120,7 @@ export default {
if (this.attachmentDrawerVisible) {
this.attachmentDrawerVisible = false
}
window.onbeforeunload = null
},
beforeRouteLeave(to, from, next) {
if (this.postSettingVisible) {
@ -128,7 +129,25 @@ export default {
if (this.attachmentDrawerVisible) {
this.attachmentDrawerVisible = false
}
next()
if (this.postToStage.originalContent) {
const answer = window.confirm('当前文章数据未保存,确定要离开吗?')
if (answer) {
next()
} else {
next(false)
}
} else {
next()
}
},
mounted() {
window.onbeforeunload = function(e) {
e = e || window.event
if (e) {
e.returnValue = '当前文章数据未保存,确定要离开吗?'
}
return '当前文章数据未保存,确定要离开吗?'
}
},
computed: {
...mapGetters(['options'])

View File

@ -110,6 +110,7 @@ export default {
if (this.attachmentDrawerVisible) {
this.attachmentDrawerVisible = false
}
window.onbeforeunload = null
},
beforeRouteLeave(to, from, next) {
if (this.sheetSettingVisible) {
@ -118,7 +119,25 @@ export default {
if (this.attachmentDrawerVisible) {
this.attachmentDrawerVisible = false
}
next()
if (this.sheetToStage.originalContent) {
const answer = window.confirm('当前页面数据未保存,确定要离开吗?')
if (answer) {
next()
} else {
next(false)
}
} else {
next()
}
},
mounted() {
window.onbeforeunload = function(e) {
e = e || window.event
if (e) {
e.returnValue = '当前页面数据未保存,确定要离开吗?'
}
return '当前页面数据未保存,确定要离开吗?'
}
},
computed: {
...mapGetters(['options'])