[Build] dynamic import (#1168)

This commit is contained in:
neverland
2018-05-27 12:01:21 +08:00
committed by GitHub
parent a5413aebfa
commit ea8d325c2c
9 changed files with 236 additions and 230 deletions

View File

@@ -2,6 +2,7 @@ import Vue from 'vue';
import VueRouter from 'vue-router';
import App from './WapApp';
import routes from './router';
import progress from 'nprogress';
import '../../packages/vant-css/src/index.css';
import '../../packages/vant-css/src/icon-local.css';
import 'vant-doc/src/helper/touch-simulator';
@@ -13,7 +14,13 @@ const router = new VueRouter({
routes: routes(true)
});
router.beforeEach((route, redirect, next) => {
progress.start();
next();
});
router.afterEach(() => {
progress.done();
if (router.currentRoute.name) {
window.scrollTo(0, 0);
}