fix mobile style

This commit is contained in:
cookfront
2017-04-20 15:39:40 +08:00
parent 5d0cdbc3f1
commit 39b0d0f094
5 changed files with 77 additions and 30 deletions

View File

@@ -27,25 +27,14 @@ const router = new VueRouter({
routes: routesConfig
});
let indexScrollTop = 0;
router.beforeEach((route, redirect, next) => {
if (route.path !== '/') {
indexScrollTop = document.body.scrollTop;
window.scrollTo(0, 0);
}
document.title = route.meta.title || document.title;
next();
});
router.afterEach(route => {
if (route.path !== '/') {
document.body.scrollTop = 0;
} else {
Vue.nextTick(() => {
document.body.scrollTop = indexScrollTop;
});
}
});
new Vue({ // eslint-disable-line
render: h => h(App),
router