fix to.hash

master
git 8 years ago
parent 88047f60b0
commit 9493161003

@ -799,7 +799,8 @@ var router = new __WEBPACK_IMPORTED_MODULE_0_vue_router___default.a({
if (savedPosition) { if (savedPosition) {
return savedPosition; return savedPosition;
} else if (to.hash) { } else if (to.hash) {
return { selector: to.hash }; var el = document.querySelector(to.hash);
return { x: 0, y: el ? el.offsetTop : 0 };
} else { } else {
return { x: 0, y: 0 }; return { x: 0, y: 0 };
} }

File diff suppressed because one or more lines are too long

@ -58,7 +58,8 @@ const router = new VueRouter({
if (savedPosition) { if (savedPosition) {
return savedPosition return savedPosition
} else if (to.hash) { } else if (to.hash) {
return { selector: to.hash } let el = document.querySelector(to.hash)
return { x: 0, y: el ? el.offsetTop : 0 }
} else { } else {
return { x: 0, y: 0 } return { x: 0, y: 0 }
} }

Loading…
Cancel
Save