From 252573372993e2909079add2279953aee347338e Mon Sep 17 00:00:00 2001 From: zhigang.li Date: Fri, 29 Jun 2018 17:31:05 +0800 Subject: [PATCH] 解决anchor组件在页面没有点击锚点时报错的问题 --- src/components/anchor/anchor.vue | 1 + 1 file changed, 1 insertion(+), 0 deletions(-) diff --git a/src/components/anchor/anchor.vue b/src/components/anchor/anchor.vue index 0e273d2..c86a8af 100644 --- a/src/components/anchor/anchor.vue +++ b/src/components/anchor/anchor.vue @@ -93,6 +93,7 @@ export default { handleHashChange () { const url = window.location.href; const sharpLinkMatch = sharpMatcherRegx.exec(url); + if (!sharpLinkMatch) return; this.currentLink = sharpLinkMatch[0]; this.currentId = sharpLinkMatch[1]; }, -- libgit2 0.21.4