mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 18:54:24 +00:00
[Doc] add build-in style document (#633)
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
class="van-doc-nav-bar"
|
||||
:title="title"
|
||||
left-arrow
|
||||
:left-text="$t('back')"
|
||||
@click-left="onBack"
|
||||
/>
|
||||
<router-view />
|
||||
@@ -14,13 +13,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { camelize } from 'packages/utils';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
title() {
|
||||
const name = this.$route.name;
|
||||
return name ? camelize(name.split('/').pop()) : '';
|
||||
const { name } = this.$route.meta;
|
||||
return name ? name.replace(/-/g, '') : '';
|
||||
}
|
||||
},
|
||||
|
||||
|
@@ -37,6 +37,10 @@ module.exports = {
|
||||
title: '更新日志',
|
||||
noExample: true
|
||||
},
|
||||
{
|
||||
path: '/built-in-style',
|
||||
title: '内置样式'
|
||||
},
|
||||
{
|
||||
path: '/theme',
|
||||
title: '定制主题',
|
||||
@@ -319,6 +323,10 @@ module.exports = {
|
||||
title: 'Changelog',
|
||||
noExample: true
|
||||
},
|
||||
{
|
||||
path: '/built-in-style',
|
||||
title: 'Built-in style'
|
||||
},
|
||||
{
|
||||
path: '/theme',
|
||||
title: 'Custom Theme',
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import Vue from 'vue';
|
||||
import VueRouter from 'vue-router';
|
||||
import App from './WapApp';
|
||||
import routes from './router.config';
|
||||
import routes from './router';
|
||||
import Vant, { Lazyload } from 'packages';
|
||||
import VantDoc from 'vant-doc';
|
||||
import 'packages/vant-css/src/index.css';
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import Vue from 'vue';
|
||||
import VueRouter from 'vue-router';
|
||||
import App from './DocsApp';
|
||||
import routes from './router.config';
|
||||
import routes from './router';
|
||||
import VantDoc from 'vant-doc';
|
||||
import isMobile from './utils/is-mobile';
|
||||
import './components/nprogress.css';
|
||||
|
@@ -28,22 +28,20 @@ const registerRoute = (isExample) => {
|
||||
|
||||
const navs = docConfig[lang].nav || [];
|
||||
navs.forEach(nav => {
|
||||
if (isExample && !nav.showInMobile) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (nav.groups) {
|
||||
nav.groups.forEach(group => {
|
||||
group.list.forEach(page => addRoute(page, lang));
|
||||
});
|
||||
} else if (nav.children) {
|
||||
nav.children.forEach(page => addRoute(page, lang));
|
||||
} else {
|
||||
addRoute(nav, lang);
|
||||
}
|
||||
});
|
||||
|
||||
function addRoute(page, lang) {
|
||||
if (isExample && page.noExample) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { path } = page;
|
||||
if (path) {
|
||||
const name = lang + '/' + path.replace('/', '');
|
||||
@@ -59,7 +57,10 @@ const registerRoute = (isExample) => {
|
||||
name,
|
||||
component,
|
||||
path: `/${lang}/component${path}`,
|
||||
meta: { lang }
|
||||
meta: {
|
||||
lang,
|
||||
name: page.title
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user