mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 10:07:07 +00:00
fix docs
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user