Commit 252573372993e2909079add2279953aee347338e
1 parent
b23702cb
解决anchor组件在页面没有点击锚点时报错的问题
Showing
1 changed file
with
1 additions
and
0 deletions
Show diff stats
src/components/anchor/anchor.vue
| ... | ... | @@ -93,6 +93,7 @@ export default { |
| 93 | 93 | handleHashChange () { |
| 94 | 94 | const url = window.location.href; |
| 95 | 95 | const sharpLinkMatch = sharpMatcherRegx.exec(url); |
| 96 | + if (!sharpLinkMatch) return; | |
| 96 | 97 | this.currentLink = sharpLinkMatch[0]; |
| 97 | 98 | this.currentId = sharpLinkMatch[1]; |
| 98 | 99 | }, | ... | ... |