build: add files of vant-cli 2

This commit is contained in:
陈嘉涵
2019-11-18 16:40:43 +08:00
parent 28e2849087
commit 6514b650d0
46 changed files with 12125 additions and 249 deletions
+32
View File
@@ -0,0 +1,32 @@
<template>
<div class="app">
<van-doc :config="config" :simulator="simulator">
<router-view />
</van-doc>
</div>
</template>
<script>
import { config } from '../../dist/desktop-config';
export default {
data() {
return {
config,
simulator: `mobile.html${location.hash}`
};
}
};
</script>
<style lang="less">
.van-doc-intro {
padding-top: 20px;
font-family: "Dosis", "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
text-align: center;
p {
margin-bottom: 20px;
}
}
</style>
+13
View File
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
<meta http-Equiv="Cache-Control" Content="no-cache" />
<meta http-Equiv="Pragma" Content="no-cache" />
<meta http-Equiv="Expires" Content="0" />
</head>
<body ontouchstart>
<div id="app"></div>
</body>
</html>
+38
View File
@@ -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
});
+24
View File
@@ -0,0 +1,24 @@
import { documents } from '../../dist/desktop-config';
const routes = [];
const names = Object.keys(documents);
Object.keys(documents).forEach((name, index) => {
if (index === 0) {
routes.push({
path: '*',
redirect: () => `/${names[0]}`
});
}
routes.push({
name,
component: documents[name],
path: `/${name}`,
meta: {
name
}
});
});
export default routes;