build: add files of vant-cli 2
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import Vue from 'vue';
|
||||
import VueRouter from 'vue-router';
|
||||
import VantDoc from '@vant/doc';
|
||||
import App from './App';
|
||||
import routes from './router';
|
||||
import { isMobile } from '../common';
|
||||
import '../common/iframe-router';
|
||||
|
||||
Vue.use(VantDoc);
|
||||
Vue.use(VueRouter);
|
||||
|
||||
if (isMobile) {
|
||||
location.replace('mobile.html' + location.hash);
|
||||
}
|
||||
|
||||
const router = new VueRouter({
|
||||
mode: 'hash',
|
||||
routes,
|
||||
scrollBehavior(to) {
|
||||
if (to.hash) {
|
||||
return { selector: to.hash };
|
||||
}
|
||||
|
||||
return { x: 0, y: 0 };
|
||||
}
|
||||
});
|
||||
|
||||
router.afterEach(() => {
|
||||
Vue.nextTick(() => window.syncPath());
|
||||
});
|
||||
|
||||
window.vueRouter = router;
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
render: h => h(App),
|
||||
router
|
||||
});
|
||||
Reference in New Issue
Block a user