vant/docs/src/mobile.js
2018-08-08 15:43:31 +08:00

40 lines
832 B
JavaScript

import '../../packages/vant-css/src/index.css';
import Vue from 'vue';
import VueRouter from 'vue-router';
import App from './WapApp';
import routes from './router';
import { progress } from 'vant-doc';
import 'vant-doc/helper/touch-simulator';
const router = new VueRouter({
mode: 'hash',
routes: routes(true),
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());
}
});
window.vueRouter = router;
if (process.env.NODE_ENV !== 'production') {
Vue.config.productionTip = false;
}
new Vue({ // eslint-disable-line
render: h => h(App),
router,
el: '#app'
});