From 323408f8d981bd3c75727a16ed046f2260aa258e Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 10 Oct 2018 17:43:33 +0800 Subject: [PATCH 1/3] fix[ExternalLink]: fixed bug when url include chinese #1182 --- src/utils/index.js | 4 ++++ src/views/layout/components/Sidebar/Link.vue | 4 ++-- src/views/layout/components/Sidebar/SidebarItem.vue | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index f607910c..3af8b29b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -296,3 +296,7 @@ export function deepClone(source) { export function uniqueArr(arr) { return Array.from(new Set(arr)) } + +export function isExternal(path) { + return /^(https?:|mailto:|tel:)/.test(path) +} diff --git a/src/views/layout/components/Sidebar/Link.vue b/src/views/layout/components/Sidebar/Link.vue index 07793b9a..5d366f24 100644 --- a/src/views/layout/components/Sidebar/Link.vue +++ b/src/views/layout/components/Sidebar/Link.vue @@ -7,7 +7,7 @@