From 3802f6f8d27aa67bdeec4b15eec684f7d833b3fd Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 10 Oct 2018 17:43:33 +0800 Subject: [PATCH] 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 @@