This commit is contained in:
cookfront
2017-03-22 10:49:34 +08:00
parent 7f6ac15fca
commit dd13bec2d2
4 changed files with 21 additions and 28 deletions

View File

@@ -35,7 +35,9 @@ const router = new VueRouter({
});
router.beforeEach((route, redirect, next) => {
window.scrollTo(0, 0);
if (route.path !== '/') {
window.scrollTo(0, 0);
}
if (isMobile()) {
window.location.replace(location.pathname + 'examples.html#' + route.path);
return;
@@ -44,6 +46,15 @@ router.beforeEach((route, redirect, next) => {
next();
});
router.afterEach((route) => {
if (route.page !== '/') {
const sideNavHeight = document.querySelector('.side-nav').clientHeight;
const pageContentBox = document.querySelector('.page-content');
const pageContentHeight = pageContentBox.clientHeight;
pageContentBox.style.height = Math.max(sideNavHeight, pageContentHeight) + 'px';
}
});
new Vue({ // eslint-disable-line
render: h => h(App),
router