解决anchor组件在页面没有点击锚点时报错的问题

This commit is contained in:
zhigang.li 2018-06-29 17:31:05 +08:00
parent b23702cb13
commit 2525733729

View file

@ -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];
},