From 7763a1cc0df37d88f082f48de022f9d822bf1453 Mon Sep 17 00:00:00 2001 From: ronger Date: Thu, 18 Mar 2021 22:37:30 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E5=A2=9E=E5=8A=A0=E5=88=B7?= =?UTF-8?q?=E6=96=B0/=E5=85=B3=E9=97=AD=E7=BC=96=E8=BE=91=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E6=8F=90=E7=A4=BA=20https://github.com/rymcu/forest/i?= =?UTF-8?q?ssues/34?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/admin/tag/post/_tag_id.vue | 11 +++++++++++ pages/admin/topic/post/_topic_id.vue | 11 +++++++++++ pages/article/post/_article_id.vue | 11 +++++++++++ pages/portfolio/post/_portfolio_id.vue | 11 +++++++++++ 4 files changed, 44 insertions(+) diff --git a/pages/admin/tag/post/_tag_id.vue b/pages/admin/tag/post/_tag_id.vue index 6305370..ce3043f 100644 --- a/pages/admin/tag/post/_tag_id.vue +++ b/pages/admin/tag/post/_tag_id.vue @@ -239,6 +239,17 @@ export default { } }, mounted() { + window.addEventListener('beforeunload', e => { + e = e || window.event; + + // 兼容IE8和Firefox 4之前的版本 + if (e) { + e.returnValue = '关闭提示'; + } + + // Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+ + return '关闭提示'; + }); let _ts = this; this.$store.commit('setActiveMenu', 'postAdminTag'); this.$axios.$get('/api/upload/simple/token').then(function (res) { diff --git a/pages/admin/topic/post/_topic_id.vue b/pages/admin/topic/post/_topic_id.vue index 2784ee5..aa992b8 100644 --- a/pages/admin/topic/post/_topic_id.vue +++ b/pages/admin/topic/post/_topic_id.vue @@ -255,6 +255,17 @@ export default { } }, async mounted() { + window.addEventListener('beforeunload', e => { + e = e || window.event; + + // 兼容IE8和Firefox 4之前的版本 + if (e) { + e.returnValue = '关闭提示'; + } + + // Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+ + return '关闭提示'; + }); let _ts = this; _ts.$store.commit("setActiveMenu", "admin-topic-post"); _ts.$axios.$get('/api/upload/simple/token').then(function (res) { diff --git a/pages/article/post/_article_id.vue b/pages/article/post/_article_id.vue index 9af21bf..0d3a43f 100644 --- a/pages/article/post/_article_id.vue +++ b/pages/article/post/_article_id.vue @@ -322,6 +322,17 @@ } }, async mounted() { + window.addEventListener('beforeunload', e => { + e = e || window.event; + + // 兼容IE8和Firefox 4之前的版本 + if (e) { + e.returnValue = '关闭提示'; + } + + // Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+ + return '关闭提示'; + }); let _ts = this; _ts.$store.commit('setActiveMenu', 'post-article'); const responseData = await _ts.$axios.$get('/api/upload/token'); diff --git a/pages/portfolio/post/_portfolio_id.vue b/pages/portfolio/post/_portfolio_id.vue index 211f01e..c8d898a 100644 --- a/pages/portfolio/post/_portfolio_id.vue +++ b/pages/portfolio/post/_portfolio_id.vue @@ -339,6 +339,17 @@ export default { } }, mounted() { + window.addEventListener('beforeunload', e => { + e = e || window.event; + + // 兼容IE8和Firefox 4之前的版本 + if (e) { + e.returnValue = '关闭提示'; + } + + // Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+ + return '关闭提示'; + }); let _ts = this; _ts.$store.commit("setActiveMenu", "portfolio-post"); this.$axios.$get('/api/upload/simple/token').then(function (res) {