解决anchor组件在页面没有点击锚点时报错的问题
This commit is contained in:
parent
b23702cb13
commit
2525733729
1 changed files with 1 additions and 0 deletions
|
@ -93,6 +93,7 @@ export default {
|
||||||
handleHashChange () {
|
handleHashChange () {
|
||||||
const url = window.location.href;
|
const url = window.location.href;
|
||||||
const sharpLinkMatch = sharpMatcherRegx.exec(url);
|
const sharpLinkMatch = sharpMatcherRegx.exec(url);
|
||||||
|
if (!sharpLinkMatch) return;
|
||||||
this.currentLink = sharpLinkMatch[0];
|
this.currentLink = sharpLinkMatch[0];
|
||||||
this.currentId = sharpLinkMatch[1];
|
this.currentId = sharpLinkMatch[1];
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue