[Doc] update demo
This commit is contained in:
+7
-8
@@ -1,26 +1,25 @@
|
||||
import '../../packages/index.less';
|
||||
import Vue from 'vue';
|
||||
import VueRouter from 'vue-router';
|
||||
import { progress } from '@vant/doc';
|
||||
import App from './WapApp';
|
||||
import routes from './router';
|
||||
import { importAll } from './utils';
|
||||
import '@vant/touch-emulator';
|
||||
|
||||
const componentMap = {};
|
||||
const context = require.context('../../packages', true, /demo\/index.vue$/);
|
||||
|
||||
importAll(componentMap, context);
|
||||
|
||||
const router = new VueRouter({
|
||||
mode: 'hash',
|
||||
routes: routes(true),
|
||||
routes: routes({ mobile: true, componentMap }),
|
||||
scrollBehavior(to, from, savedPosition) {
|
||||
return savedPosition || { x: 0, y: 0 };
|
||||
}
|
||||
});
|
||||
|
||||
router.beforeEach((route, redirect, next) => {
|
||||
progress.start();
|
||||
next();
|
||||
});
|
||||
|
||||
router.afterEach(() => {
|
||||
progress.done();
|
||||
if (!router.currentRoute.redirectedFrom) {
|
||||
Vue.nextTick(() => window.syncPath());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user