diff --git a/pages/admin/tag/post/_tag_id.vue b/pages/admin/tag/post/_tag_id.vue index ce3043f..defede7 100644 --- a/pages/admin/tag/post/_tag_id.vue +++ b/pages/admin/tag/post/_tag_id.vue @@ -238,6 +238,20 @@ export default { }) } }, + beforeRouteLeave(to, from, next) { + this.$confirm('系统可能不会保存您所做的更改。', '离开此网站?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + next(); + }).catch(() => { + return false + }); + }, + beforeDestroy() { + window.onbeforeunload = null; + }, mounted() { window.addEventListener('beforeunload', e => { e = e || window.event; diff --git a/pages/admin/topic/post/_topic_id.vue b/pages/admin/topic/post/_topic_id.vue index aa992b8..9da4c6f 100644 --- a/pages/admin/topic/post/_topic_id.vue +++ b/pages/admin/topic/post/_topic_id.vue @@ -254,6 +254,20 @@ export default { }) } }, + beforeRouteLeave(to, from, next) { + this.$confirm('系统可能不会保存您所做的更改。', '离开此网站?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + next(); + }).catch(() => { + return false + }); + }, + beforeDestroy() { + window.onbeforeunload = null; + }, async mounted() { window.addEventListener('beforeunload', e => { e = e || window.event; diff --git a/pages/article/post/_article_id.vue b/pages/article/post/_article_id.vue index 0d3a43f..62c71ff 100644 --- a/pages/article/post/_article_id.vue +++ b/pages/article/post/_article_id.vue @@ -48,6 +48,7 @@