[Doc] update demo

This commit is contained in:
陈嘉涵
2019-05-29 11:23:10 +08:00
parent 3bc5a93941
commit 764cad3393
12 changed files with 61 additions and 156 deletions
+7 -8
View File
@@ -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());
}