From e2e60c813adf35e0703cc4da620bf1afa5b63644 Mon Sep 17 00:00:00 2001 From: wangchenguang <728837162@qq.com> Date: Mon, 17 Apr 2023 17:58:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mixins/article/index.js | 16 ++++++++++++++-- src/mixins/page/index.js | 11 +++++++++-- src/pages/column/index.vue | 8 +++++++- src/pages/home/index.vue | 2 +- src/pages/news/index.vue | 9 ++++++++- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/mixins/article/index.js b/src/mixins/article/index.js index 09a1ad5..573d474 100644 --- a/src/mixins/article/index.js +++ b/src/mixins/article/index.js @@ -41,7 +41,13 @@ export default { } // 是否新窗口打开 if (to.isOpen) { - window.open(href) + var userAgent = navigator.userAgent; + var isSafari = /Safari/.test(userAgent) && !/Chrome/.test(userAgent); + if(isSafari) { + window.location.href = href + }else { + window.open(href) + } } else { location.href = href } @@ -71,7 +77,13 @@ export default { } // 是否新窗口打开 if (item.isOpen) { - window.open(href) + var userAgent = navigator.userAgent; + var isSafari = /Safari/.test(userAgent) && !/Chrome/.test(userAgent); + if(isSafari) { + window.location.href = href + }else { + window.open(href) + } } else { location.href = href } diff --git a/src/mixins/page/index.js b/src/mixins/page/index.js index fcacf9f..2770c50 100644 --- a/src/mixins/page/index.js +++ b/src/mixins/page/index.js @@ -62,9 +62,16 @@ export default { // 跳转地址 toHref(isOpen, href) { if (isOpen) { - window.open(href) + var userAgent = navigator.userAgent; + var isSafari = /Safari/.test(userAgent) && !/Chrome/.test(userAgent); + if(isSafari) { + window.location.href = href + }else { + window.open(href) + } } else { - location.href = href + + window.location.href = href } }, // 跳转文章页面 diff --git a/src/pages/column/index.vue b/src/pages/column/index.vue index d40c324..29847de 100644 --- a/src/pages/column/index.vue +++ b/src/pages/column/index.vue @@ -413,7 +413,13 @@ export default { } // 是否新窗口打开 if (to.isOpen) { - window.open(href); + var userAgent = navigator.userAgent; + var isSafari = /Safari/.test(userAgent) && !/Chrome/.test(userAgent); + if(isSafari) { + window.location.href = href + }else { + window.open(href) + } } else { location.href = href; } diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue index 7d795b7..1ea460e 100644 --- a/src/pages/home/index.vue +++ b/src/pages/home/index.vue @@ -64,7 +64,7 @@
{{ item.title }}

{{ item.des }}

- +
diff --git a/src/pages/news/index.vue b/src/pages/news/index.vue index 2a08962..2b37e0c 100644 --- a/src/pages/news/index.vue +++ b/src/pages/news/index.vue @@ -260,7 +260,14 @@ export default { } // 是否新窗口打开 if (data.isOpen) { - window.open(href) + // window.open(href) + var userAgent = navigator.userAgent; + var isSafari = /Safari/.test(userAgent) && !/Chrome/.test(userAgent); + if(isSafari) { + window.location.href = href + }else { + window.open(href) + } } else { location.href = href }