[Improvement] Reorganize document (#1066)

This commit is contained in:
neverland 2018-05-15 10:39:01 +08:00 committed by GitHub
parent b1142fd862
commit e8aad7246c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
124 changed files with 181 additions and 186 deletions

View File

@ -19,4 +19,4 @@ github_changelog_generator \
--no-unreleased \
--max-issues 200 \
--since-tag v1.0.0 \
-o $basepath/../../docs/markdown/zh-CN/changelog-generated.md
-o $basepath/../../docs/markdown/changelog.generated.md

View File

@ -1,9 +1,12 @@
const Components = require('./get-components')();
const fs = require('fs-extra');
const glob = require('fast-glob');
const path = require('path');
const uppercamelize = require('uppercamelcase');
const version = process.env.VERSION || require('../../package.json').version;
const tips = '// This file is auto gererated by build/bin/build-entry.js';
const root = path.join(__dirname, '../../');
const join = dir => path.join(root, dir);
function buildVantEntry() {
const uninstallComponents = [
@ -64,14 +67,20 @@ export default {
fs.writeFileSync(path.join(dir, '../docs/src/demo-entry.js'), content);
}
// generate webpack entry file for markdown docs
function buildDocsEntry() {
const dir = path.join(__dirname, '../../docs/markdown');
const cnDocs = fs.readdirSync(path.join(dir, 'zh-CN')).map(name => 'zh-CN/' + name);
const enDocs = fs.readdirSync(path.join(dir, 'en-US')).map(name => 'en-US/' + name);
const docs = [...cnDocs, ...enDocs]
.filter(name => name.indexOf('.md') !== -1)
.map(name => name.replace('.md', ''))
.map(name => `'${name}': wrapper(r => require.ensure([], () => r(require('./${name}.md')), '${name}'))`);
const output = join('docs/src/docs-entry.js');
const getName = fullPath => fullPath.replace(/\/(en|zh)/, '.$1').split('/').pop().replace('.md', '');
const docs = glob
.sync([
join('docs/**/*.md'),
join('packages/**/*.md'),
'!**/node_modules/**'
])
.map(fullPath => {
const name = getName(fullPath);
return `'${name}': wrapper(r => require.ensure([], () => r(require('${path.relative(join('docs/src'), fullPath)}')), '${name}'))`;
});
const content = `${tips}
import progress from 'nprogress';
@ -91,7 +100,7 @@ export default {
${docs.join(',\n ')}
};
`;
fs.writeFileSync(path.join(dir, './index.js'), content);
fs.writeFileSync(output, content);
}
buildVantEntry();

View File

@ -67,7 +67,7 @@ module.exports = {
]
},
{
test: /\.(woff2?|eot|ttf|svg)(\?.*)?$/,
test: /\.(ttf|svg)(\?.*)?$/,
loader: 'url-loader'
}
]

View File

@ -1,133 +0,0 @@
// This file is auto gererated by build/bin/build-entry.js
import progress from 'nprogress';
function wrapper(component) {
return function(r) {
progress.start();
component(r).then(() => {
progress.done();
}).catch(() => {
progress.done();
});
};
}
export default {
'zh-CN/actionsheet': wrapper(r => require.ensure([], () => r(require('./zh-CN/actionsheet.md')), 'zh-CN/actionsheet')),
'zh-CN/address-edit': wrapper(r => require.ensure([], () => r(require('./zh-CN/address-edit.md')), 'zh-CN/address-edit')),
'zh-CN/address-list': wrapper(r => require.ensure([], () => r(require('./zh-CN/address-list.md')), 'zh-CN/address-list')),
'zh-CN/area': wrapper(r => require.ensure([], () => r(require('./zh-CN/area.md')), 'zh-CN/area')),
'zh-CN/badge': wrapper(r => require.ensure([], () => r(require('./zh-CN/badge.md')), 'zh-CN/badge')),
'zh-CN/button': wrapper(r => require.ensure([], () => r(require('./zh-CN/button.md')), 'zh-CN/button')),
'zh-CN/card': wrapper(r => require.ensure([], () => r(require('./zh-CN/card.md')), 'zh-CN/card')),
'zh-CN/cell-swipe': wrapper(r => require.ensure([], () => r(require('./zh-CN/cell-swipe.md')), 'zh-CN/cell-swipe')),
'zh-CN/cell': wrapper(r => require.ensure([], () => r(require('./zh-CN/cell.md')), 'zh-CN/cell')),
'zh-CN/changelog-generated': wrapper(r => require.ensure([], () => r(require('./zh-CN/changelog-generated.md')), 'zh-CN/changelog-generated')),
'zh-CN/changelog': wrapper(r => require.ensure([], () => r(require('./zh-CN/changelog.md')), 'zh-CN/changelog')),
'zh-CN/checkbox': wrapper(r => require.ensure([], () => r(require('./zh-CN/checkbox.md')), 'zh-CN/checkbox')),
'zh-CN/circle': wrapper(r => require.ensure([], () => r(require('./zh-CN/circle.md')), 'zh-CN/circle')),
'zh-CN/col': wrapper(r => require.ensure([], () => r(require('./zh-CN/col.md')), 'zh-CN/col')),
'zh-CN/collapse': wrapper(r => require.ensure([], () => r(require('./zh-CN/collapse.md')), 'zh-CN/collapse')),
'zh-CN/contact-card': wrapper(r => require.ensure([], () => r(require('./zh-CN/contact-card.md')), 'zh-CN/contact-card')),
'zh-CN/coupon-list': wrapper(r => require.ensure([], () => r(require('./zh-CN/coupon-list.md')), 'zh-CN/coupon-list')),
'zh-CN/datetime-picker': wrapper(r => require.ensure([], () => r(require('./zh-CN/datetime-picker.md')), 'zh-CN/datetime-picker')),
'zh-CN/dialog': wrapper(r => require.ensure([], () => r(require('./zh-CN/dialog.md')), 'zh-CN/dialog')),
'zh-CN/field': wrapper(r => require.ensure([], () => r(require('./zh-CN/field.md')), 'zh-CN/field')),
'zh-CN/goods-action': wrapper(r => require.ensure([], () => r(require('./zh-CN/goods-action.md')), 'zh-CN/goods-action')),
'zh-CN/i18n': wrapper(r => require.ensure([], () => r(require('./zh-CN/i18n.md')), 'zh-CN/i18n')),
'zh-CN/icon': wrapper(r => require.ensure([], () => r(require('./zh-CN/icon.md')), 'zh-CN/icon')),
'zh-CN/image-preview': wrapper(r => require.ensure([], () => r(require('./zh-CN/image-preview.md')), 'zh-CN/image-preview')),
'zh-CN/intro': wrapper(r => require.ensure([], () => r(require('./zh-CN/intro.md')), 'zh-CN/intro')),
'zh-CN/lazyload': wrapper(r => require.ensure([], () => r(require('./zh-CN/lazyload.md')), 'zh-CN/lazyload')),
'zh-CN/list': wrapper(r => require.ensure([], () => r(require('./zh-CN/list.md')), 'zh-CN/list')),
'zh-CN/loading': wrapper(r => require.ensure([], () => r(require('./zh-CN/loading.md')), 'zh-CN/loading')),
'zh-CN/nav-bar': wrapper(r => require.ensure([], () => r(require('./zh-CN/nav-bar.md')), 'zh-CN/nav-bar')),
'zh-CN/notice-bar': wrapper(r => require.ensure([], () => r(require('./zh-CN/notice-bar.md')), 'zh-CN/notice-bar')),
'zh-CN/number-keyboard': wrapper(r => require.ensure([], () => r(require('./zh-CN/number-keyboard.md')), 'zh-CN/number-keyboard')),
'zh-CN/pagination': wrapper(r => require.ensure([], () => r(require('./zh-CN/pagination.md')), 'zh-CN/pagination')),
'zh-CN/panel': wrapper(r => require.ensure([], () => r(require('./zh-CN/panel.md')), 'zh-CN/panel')),
'zh-CN/password-input': wrapper(r => require.ensure([], () => r(require('./zh-CN/password-input.md')), 'zh-CN/password-input')),
'zh-CN/picker': wrapper(r => require.ensure([], () => r(require('./zh-CN/picker.md')), 'zh-CN/picker')),
'zh-CN/popup': wrapper(r => require.ensure([], () => r(require('./zh-CN/popup.md')), 'zh-CN/popup')),
'zh-CN/progress': wrapper(r => require.ensure([], () => r(require('./zh-CN/progress.md')), 'zh-CN/progress')),
'zh-CN/pull-refresh': wrapper(r => require.ensure([], () => r(require('./zh-CN/pull-refresh.md')), 'zh-CN/pull-refresh')),
'zh-CN/quickstart': wrapper(r => require.ensure([], () => r(require('./zh-CN/quickstart.md')), 'zh-CN/quickstart')),
'zh-CN/radio': wrapper(r => require.ensure([], () => r(require('./zh-CN/radio.md')), 'zh-CN/radio')),
'zh-CN/rate': wrapper(r => require.ensure([], () => r(require('./zh-CN/rate.md')), 'zh-CN/rate')),
'zh-CN/search': wrapper(r => require.ensure([], () => r(require('./zh-CN/search.md')), 'zh-CN/search')),
'zh-CN/sku': wrapper(r => require.ensure([], () => r(require('./zh-CN/sku.md')), 'zh-CN/sku')),
'zh-CN/slider': wrapper(r => require.ensure([], () => r(require('./zh-CN/slider.md')), 'zh-CN/slider')),
'zh-CN/stepper': wrapper(r => require.ensure([], () => r(require('./zh-CN/stepper.md')), 'zh-CN/stepper')),
'zh-CN/steps': wrapper(r => require.ensure([], () => r(require('./zh-CN/steps.md')), 'zh-CN/steps')),
'zh-CN/submit-bar': wrapper(r => require.ensure([], () => r(require('./zh-CN/submit-bar.md')), 'zh-CN/submit-bar')),
'zh-CN/swipe': wrapper(r => require.ensure([], () => r(require('./zh-CN/swipe.md')), 'zh-CN/swipe')),
'zh-CN/switch-cell': wrapper(r => require.ensure([], () => r(require('./zh-CN/switch-cell.md')), 'zh-CN/switch-cell')),
'zh-CN/switch': wrapper(r => require.ensure([], () => r(require('./zh-CN/switch.md')), 'zh-CN/switch')),
'zh-CN/tab': wrapper(r => require.ensure([], () => r(require('./zh-CN/tab.md')), 'zh-CN/tab')),
'zh-CN/tabbar': wrapper(r => require.ensure([], () => r(require('./zh-CN/tabbar.md')), 'zh-CN/tabbar')),
'zh-CN/tag': wrapper(r => require.ensure([], () => r(require('./zh-CN/tag.md')), 'zh-CN/tag')),
'zh-CN/theme': wrapper(r => require.ensure([], () => r(require('./zh-CN/theme.md')), 'zh-CN/theme')),
'zh-CN/toast': wrapper(r => require.ensure([], () => r(require('./zh-CN/toast.md')), 'zh-CN/toast')),
'zh-CN/tree-select': wrapper(r => require.ensure([], () => r(require('./zh-CN/tree-select.md')), 'zh-CN/tree-select')),
'zh-CN/uploader': wrapper(r => require.ensure([], () => r(require('./zh-CN/uploader.md')), 'zh-CN/uploader')),
'zh-CN/vant-css': wrapper(r => require.ensure([], () => r(require('./zh-CN/vant-css.md')), 'zh-CN/vant-css')),
'zh-CN/waterfall': wrapper(r => require.ensure([], () => r(require('./zh-CN/waterfall.md')), 'zh-CN/waterfall')),
'en-US/actionsheet': wrapper(r => require.ensure([], () => r(require('./en-US/actionsheet.md')), 'en-US/actionsheet')),
'en-US/address-edit': wrapper(r => require.ensure([], () => r(require('./en-US/address-edit.md')), 'en-US/address-edit')),
'en-US/address-list': wrapper(r => require.ensure([], () => r(require('./en-US/address-list.md')), 'en-US/address-list')),
'en-US/area': wrapper(r => require.ensure([], () => r(require('./en-US/area.md')), 'en-US/area')),
'en-US/badge': wrapper(r => require.ensure([], () => r(require('./en-US/badge.md')), 'en-US/badge')),
'en-US/button': wrapper(r => require.ensure([], () => r(require('./en-US/button.md')), 'en-US/button')),
'en-US/card': wrapper(r => require.ensure([], () => r(require('./en-US/card.md')), 'en-US/card')),
'en-US/cell-swipe': wrapper(r => require.ensure([], () => r(require('./en-US/cell-swipe.md')), 'en-US/cell-swipe')),
'en-US/cell': wrapper(r => require.ensure([], () => r(require('./en-US/cell.md')), 'en-US/cell')),
'en-US/changelog': wrapper(r => require.ensure([], () => r(require('./en-US/changelog.md')), 'en-US/changelog')),
'en-US/checkbox': wrapper(r => require.ensure([], () => r(require('./en-US/checkbox.md')), 'en-US/checkbox')),
'en-US/circle': wrapper(r => require.ensure([], () => r(require('./en-US/circle.md')), 'en-US/circle')),
'en-US/col': wrapper(r => require.ensure([], () => r(require('./en-US/col.md')), 'en-US/col')),
'en-US/collapse': wrapper(r => require.ensure([], () => r(require('./en-US/collapse.md')), 'en-US/collapse')),
'en-US/contact-card': wrapper(r => require.ensure([], () => r(require('./en-US/contact-card.md')), 'en-US/contact-card')),
'en-US/coupon-list': wrapper(r => require.ensure([], () => r(require('./en-US/coupon-list.md')), 'en-US/coupon-list')),
'en-US/datetime-picker': wrapper(r => require.ensure([], () => r(require('./en-US/datetime-picker.md')), 'en-US/datetime-picker')),
'en-US/dialog': wrapper(r => require.ensure([], () => r(require('./en-US/dialog.md')), 'en-US/dialog')),
'en-US/field': wrapper(r => require.ensure([], () => r(require('./en-US/field.md')), 'en-US/field')),
'en-US/goods-action': wrapper(r => require.ensure([], () => r(require('./en-US/goods-action.md')), 'en-US/goods-action')),
'en-US/i18n': wrapper(r => require.ensure([], () => r(require('./en-US/i18n.md')), 'en-US/i18n')),
'en-US/icon': wrapper(r => require.ensure([], () => r(require('./en-US/icon.md')), 'en-US/icon')),
'en-US/image-preview': wrapper(r => require.ensure([], () => r(require('./en-US/image-preview.md')), 'en-US/image-preview')),
'en-US/intro': wrapper(r => require.ensure([], () => r(require('./en-US/intro.md')), 'en-US/intro')),
'en-US/lazyload': wrapper(r => require.ensure([], () => r(require('./en-US/lazyload.md')), 'en-US/lazyload')),
'en-US/list': wrapper(r => require.ensure([], () => r(require('./en-US/list.md')), 'en-US/list')),
'en-US/loading': wrapper(r => require.ensure([], () => r(require('./en-US/loading.md')), 'en-US/loading')),
'en-US/nav-bar': wrapper(r => require.ensure([], () => r(require('./en-US/nav-bar.md')), 'en-US/nav-bar')),
'en-US/notice-bar': wrapper(r => require.ensure([], () => r(require('./en-US/notice-bar.md')), 'en-US/notice-bar')),
'en-US/number-keyboard': wrapper(r => require.ensure([], () => r(require('./en-US/number-keyboard.md')), 'en-US/number-keyboard')),
'en-US/pagination': wrapper(r => require.ensure([], () => r(require('./en-US/pagination.md')), 'en-US/pagination')),
'en-US/panel': wrapper(r => require.ensure([], () => r(require('./en-US/panel.md')), 'en-US/panel')),
'en-US/password-input': wrapper(r => require.ensure([], () => r(require('./en-US/password-input.md')), 'en-US/password-input')),
'en-US/picker': wrapper(r => require.ensure([], () => r(require('./en-US/picker.md')), 'en-US/picker')),
'en-US/popup': wrapper(r => require.ensure([], () => r(require('./en-US/popup.md')), 'en-US/popup')),
'en-US/progress': wrapper(r => require.ensure([], () => r(require('./en-US/progress.md')), 'en-US/progress')),
'en-US/pull-refresh': wrapper(r => require.ensure([], () => r(require('./en-US/pull-refresh.md')), 'en-US/pull-refresh')),
'en-US/quickstart': wrapper(r => require.ensure([], () => r(require('./en-US/quickstart.md')), 'en-US/quickstart')),
'en-US/radio': wrapper(r => require.ensure([], () => r(require('./en-US/radio.md')), 'en-US/radio')),
'en-US/rate': wrapper(r => require.ensure([], () => r(require('./en-US/rate.md')), 'en-US/rate')),
'en-US/search': wrapper(r => require.ensure([], () => r(require('./en-US/search.md')), 'en-US/search')),
'en-US/sku': wrapper(r => require.ensure([], () => r(require('./en-US/sku.md')), 'en-US/sku')),
'en-US/slider': wrapper(r => require.ensure([], () => r(require('./en-US/slider.md')), 'en-US/slider')),
'en-US/stepper': wrapper(r => require.ensure([], () => r(require('./en-US/stepper.md')), 'en-US/stepper')),
'en-US/steps': wrapper(r => require.ensure([], () => r(require('./en-US/steps.md')), 'en-US/steps')),
'en-US/submit-bar': wrapper(r => require.ensure([], () => r(require('./en-US/submit-bar.md')), 'en-US/submit-bar')),
'en-US/swipe': wrapper(r => require.ensure([], () => r(require('./en-US/swipe.md')), 'en-US/swipe')),
'en-US/switch-cell': wrapper(r => require.ensure([], () => r(require('./en-US/switch-cell.md')), 'en-US/switch-cell')),
'en-US/switch': wrapper(r => require.ensure([], () => r(require('./en-US/switch.md')), 'en-US/switch')),
'en-US/tab': wrapper(r => require.ensure([], () => r(require('./en-US/tab.md')), 'en-US/tab')),
'en-US/tabbar': wrapper(r => require.ensure([], () => r(require('./en-US/tabbar.md')), 'en-US/tabbar')),
'en-US/tag': wrapper(r => require.ensure([], () => r(require('./en-US/tag.md')), 'en-US/tag')),
'en-US/theme': wrapper(r => require.ensure([], () => r(require('./en-US/theme.md')), 'en-US/theme')),
'en-US/toast': wrapper(r => require.ensure([], () => r(require('./en-US/toast.md')), 'en-US/toast')),
'en-US/tree-select': wrapper(r => require.ensure([], () => r(require('./en-US/tree-select.md')), 'en-US/tree-select')),
'en-US/uploader': wrapper(r => require.ensure([], () => r(require('./en-US/uploader.md')), 'en-US/uploader')),
'en-US/vant-css': wrapper(r => require.ensure([], () => r(require('./en-US/vant-css.md')), 'en-US/vant-css')),
'en-US/waterfall': wrapper(r => require.ensure([], () => r(require('./en-US/waterfall.md')), 'en-US/waterfall'))
};

View File

@ -24,18 +24,15 @@ module.exports = {
list: [
{
path: '/intro',
title: '介绍',
noExample: true
title: '介绍'
},
{
path: '/quickstart',
title: '快速上手',
noExample: true
title: '快速上手'
},
{
path: '/changelog',
title: '更新日志',
noExample: true
title: '更新日志'
},
{
path: '/vant-css',
@ -43,19 +40,15 @@ module.exports = {
},
{
path: '/theme',
title: '定制主题',
noExample: true
title: '定制主题'
},
{
path: '/demo',
title: '示例页面',
noDocument: true,
noExample: true
title: '示例页面'
},
{
path: '/i18n',
title: '国际化',
noExample: true
path: '/locale',
title: '国际化'
}
]
}
@ -326,18 +319,15 @@ module.exports = {
list: [
{
path: '/intro',
title: 'Introduction',
noExample: true
title: 'Introduction'
},
{
path: '/quickstart',
title: 'Quickstart',
noExample: true
title: 'Quickstart'
},
{
path: '/changelog',
title: 'Changelog',
noExample: true
title: 'Changelog'
},
{
path: '/vant-css',
@ -345,19 +335,15 @@ module.exports = {
},
{
path: '/theme',
title: 'Custom Theme',
noExample: true
title: 'Custom Theme'
},
{
path: '/demo',
title: 'Demo pages',
noDocument: true,
noExample: true
title: 'Demo pages'
},
{
path: '/i18n',
title: 'Internationalization',
noExample: true
path: '/locale',
title: 'Internationalization'
}
]
}

133
docs/src/docs-entry.js Normal file
View File

@ -0,0 +1,133 @@
// This file is auto gererated by build/bin/build-entry.js
import progress from 'nprogress';
function wrapper(component) {
return function(r) {
progress.start();
component(r).then(() => {
progress.done();
}).catch(() => {
progress.done();
});
};
}
export default {
'changelog.en-US': wrapper(r => require.ensure([], () => r(require('../markdown/changelog.en-US.md')), 'changelog.en-US')),
'changelog.generated': wrapper(r => require.ensure([], () => r(require('../markdown/changelog.generated.md')), 'changelog.generated')),
'changelog.zh-CN': wrapper(r => require.ensure([], () => r(require('../markdown/changelog.zh-CN.md')), 'changelog.zh-CN')),
'intro.en-US': wrapper(r => require.ensure([], () => r(require('../markdown/intro.en-US.md')), 'intro.en-US')),
'intro.zh-CN': wrapper(r => require.ensure([], () => r(require('../markdown/intro.zh-CN.md')), 'intro.zh-CN')),
'quickstart.en-US': wrapper(r => require.ensure([], () => r(require('../markdown/quickstart.en-US.md')), 'quickstart.en-US')),
'quickstart.zh-CN': wrapper(r => require.ensure([], () => r(require('../markdown/quickstart.zh-CN.md')), 'quickstart.zh-CN')),
'theme.en-US': wrapper(r => require.ensure([], () => r(require('../markdown/theme.en-US.md')), 'theme.en-US')),
'theme.zh-CN': wrapper(r => require.ensure([], () => r(require('../markdown/theme.zh-CN.md')), 'theme.zh-CN')),
'actionsheet.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/actionsheet/en-US.md')), 'actionsheet.en-US')),
'actionsheet.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/actionsheet/zh-CN.md')), 'actionsheet.zh-CN')),
'address-edit.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/address-edit/en-US.md')), 'address-edit.en-US')),
'address-edit.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/address-edit/zh-CN.md')), 'address-edit.zh-CN')),
'address-list.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/address-list/en-US.md')), 'address-list.en-US')),
'address-list.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/address-list/zh-CN.md')), 'address-list.zh-CN')),
'area.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/area/en-US.md')), 'area.en-US')),
'area.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/area/zh-CN.md')), 'area.zh-CN')),
'badge.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/badge/en-US.md')), 'badge.en-US')),
'badge.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/badge/zh-CN.md')), 'badge.zh-CN')),
'button.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/button/en-US.md')), 'button.en-US')),
'button.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/button/zh-CN.md')), 'button.zh-CN')),
'card.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/card/en-US.md')), 'card.en-US')),
'card.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/card/zh-CN.md')), 'card.zh-CN')),
'cell.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/cell/en-US.md')), 'cell.en-US')),
'cell.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/cell/zh-CN.md')), 'cell.zh-CN')),
'cell-swipe.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/cell-swipe/en-US.md')), 'cell-swipe.en-US')),
'cell-swipe.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/cell-swipe/zh-CN.md')), 'cell-swipe.zh-CN')),
'checkbox.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/checkbox/en-US.md')), 'checkbox.en-US')),
'checkbox.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/checkbox/zh-CN.md')), 'checkbox.zh-CN')),
'circle.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/circle/en-US.md')), 'circle.en-US')),
'circle.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/circle/zh-CN.md')), 'circle.zh-CN')),
'col.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/col/en-US.md')), 'col.en-US')),
'col.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/col/zh-CN.md')), 'col.zh-CN')),
'collapse.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/collapse/en-US.md')), 'collapse.en-US')),
'collapse.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/collapse/zh-CN.md')), 'collapse.zh-CN')),
'contact-card.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/contact-card/en-US.md')), 'contact-card.en-US')),
'contact-card.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/contact-card/zh-CN.md')), 'contact-card.zh-CN')),
'coupon-list.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/coupon-list/en-US.md')), 'coupon-list.en-US')),
'coupon-list.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/coupon-list/zh-CN.md')), 'coupon-list.zh-CN')),
'datetime-picker.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/datetime-picker/en-US.md')), 'datetime-picker.en-US')),
'datetime-picker.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/datetime-picker/zh-CN.md')), 'datetime-picker.zh-CN')),
'dialog.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/dialog/en-US.md')), 'dialog.en-US')),
'dialog.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/dialog/zh-CN.md')), 'dialog.zh-CN')),
'field.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/field/en-US.md')), 'field.en-US')),
'field.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/field/zh-CN.md')), 'field.zh-CN')),
'goods-action.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/goods-action/en-US.md')), 'goods-action.en-US')),
'goods-action.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/goods-action/zh-CN.md')), 'goods-action.zh-CN')),
'icon.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/icon/en-US.md')), 'icon.en-US')),
'icon.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/icon/zh-CN.md')), 'icon.zh-CN')),
'image-preview.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/image-preview/en-US.md')), 'image-preview.en-US')),
'image-preview.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/image-preview/zh-CN.md')), 'image-preview.zh-CN')),
'lazyload.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/lazyload/en-US.md')), 'lazyload.en-US')),
'lazyload.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/lazyload/zh-CN.md')), 'lazyload.zh-CN')),
'list.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/list/en-US.md')), 'list.en-US')),
'list.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/list/zh-CN.md')), 'list.zh-CN')),
'loading.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/loading/en-US.md')), 'loading.en-US')),
'loading.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/loading/zh-CN.md')), 'loading.zh-CN')),
'locale.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/locale/en-US.md')), 'locale.en-US')),
'locale.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/locale/zh-CN.md')), 'locale.zh-CN')),
'nav-bar.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/nav-bar/en-US.md')), 'nav-bar.en-US')),
'nav-bar.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/nav-bar/zh-CN.md')), 'nav-bar.zh-CN')),
'notice-bar.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/notice-bar/en-US.md')), 'notice-bar.en-US')),
'notice-bar.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/notice-bar/zh-CN.md')), 'notice-bar.zh-CN')),
'number-keyboard.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/number-keyboard/en-US.md')), 'number-keyboard.en-US')),
'number-keyboard.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/number-keyboard/zh-CN.md')), 'number-keyboard.zh-CN')),
'pagination.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/pagination/en-US.md')), 'pagination.en-US')),
'pagination.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/pagination/zh-CN.md')), 'pagination.zh-CN')),
'panel.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/panel/en-US.md')), 'panel.en-US')),
'panel.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/panel/zh-CN.md')), 'panel.zh-CN')),
'password-input.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/password-input/en-US.md')), 'password-input.en-US')),
'password-input.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/password-input/zh-CN.md')), 'password-input.zh-CN')),
'picker.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/picker/en-US.md')), 'picker.en-US')),
'picker.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/picker/zh-CN.md')), 'picker.zh-CN')),
'popup.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/popup/en-US.md')), 'popup.en-US')),
'popup.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/popup/zh-CN.md')), 'popup.zh-CN')),
'progress.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/progress/en-US.md')), 'progress.en-US')),
'progress.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/progress/zh-CN.md')), 'progress.zh-CN')),
'pull-refresh.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/pull-refresh/en-US.md')), 'pull-refresh.en-US')),
'pull-refresh.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/pull-refresh/zh-CN.md')), 'pull-refresh.zh-CN')),
'radio.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/radio/en-US.md')), 'radio.en-US')),
'radio.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/radio/zh-CN.md')), 'radio.zh-CN')),
'rate.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/rate/en-US.md')), 'rate.en-US')),
'rate.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/rate/zh-CN.md')), 'rate.zh-CN')),
'search.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/search/en-US.md')), 'search.en-US')),
'search.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/search/zh-CN.md')), 'search.zh-CN')),
'sku.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/sku/en-US.md')), 'sku.en-US')),
'sku.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/sku/zh-CN.md')), 'sku.zh-CN')),
'slider.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/slider/en-US.md')), 'slider.en-US')),
'slider.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/slider/zh-CN.md')), 'slider.zh-CN')),
'stepper.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/stepper/en-US.md')), 'stepper.en-US')),
'stepper.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/stepper/zh-CN.md')), 'stepper.zh-CN')),
'steps.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/steps/en-US.md')), 'steps.en-US')),
'steps.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/steps/zh-CN.md')), 'steps.zh-CN')),
'submit-bar.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/submit-bar/en-US.md')), 'submit-bar.en-US')),
'submit-bar.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/submit-bar/zh-CN.md')), 'submit-bar.zh-CN')),
'swipe.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/swipe/en-US.md')), 'swipe.en-US')),
'swipe.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/swipe/zh-CN.md')), 'swipe.zh-CN')),
'switch.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/switch/en-US.md')), 'switch.en-US')),
'switch.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/switch/zh-CN.md')), 'switch.zh-CN')),
'switch-cell.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/switch-cell/en-US.md')), 'switch-cell.en-US')),
'switch-cell.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/switch-cell/zh-CN.md')), 'switch-cell.zh-CN')),
'tab.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/tab/en-US.md')), 'tab.en-US')),
'tab.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/tab/zh-CN.md')), 'tab.zh-CN')),
'tabbar.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/tabbar/en-US.md')), 'tabbar.en-US')),
'tabbar.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/tabbar/zh-CN.md')), 'tabbar.zh-CN')),
'tag.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/tag/en-US.md')), 'tag.en-US')),
'tag.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/tag/zh-CN.md')), 'tag.zh-CN')),
'toast.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/toast/en-US.md')), 'toast.en-US')),
'toast.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/toast/zh-CN.md')), 'toast.zh-CN')),
'tree-select.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/tree-select/en-US.md')), 'tree-select.en-US')),
'tree-select.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/tree-select/zh-CN.md')), 'tree-select.zh-CN')),
'uploader.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/uploader/en-US.md')), 'uploader.en-US')),
'uploader.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/uploader/zh-CN.md')), 'uploader.zh-CN')),
'vant-css.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/vant-css/en-US.md')), 'vant-css.en-US')),
'vant-css.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/vant-css/zh-CN.md')), 'vant-css.zh-CN')),
'waterfall.en-US': wrapper(r => require.ensure([], () => r(require('../../packages/waterfall/en-US.md')), 'waterfall.en-US')),
'waterfall.zh-CN': wrapper(r => require.ensure([], () => r(require('../../packages/waterfall/zh-CN.md')), 'waterfall.zh-CN'))
};

View File

@ -1,19 +1,19 @@
import Vue from 'vue';
import docConfig from './doc.config';
import DemoList from './components/DemoList';
import componentDocs from '../markdown';
import componentDocs from './docs-entry';
import componentDemos from './demo-entry';
import DemoPages from './components/DemoPages';
import Vue from 'vue';
import './utils/iframe-router';
const registerRoute = (isExample) => {
const registerRoute = (isDemo) => {
const route = [{
path: '*',
redirect: to => `/${Vue.prototype.$vantLang}/`
}];
Object.keys(docConfig).forEach((lang, index) => {
if (isExample) {
if (isDemo) {
route.push({
path: `/${lang}`,
component: DemoList,
@ -38,25 +38,25 @@ const registerRoute = (isExample) => {
});
function addRoute(page, lang) {
if (isExample && page.noExample) {
return;
}
const { path } = page;
let { path } = page;
if (path) {
const name = lang + '/' + path.replace('/', '');
let component;
path = path.replace('/', '');
if (path === '/demo') {
let component;
if (path === 'demo') {
component = DemoPages;
} else {
component = isExample ? componentDemos[path.replace('/', '')] : componentDocs[name];
component = isDemo ? componentDemos[path] : componentDocs[`${path}.${lang}`];
}
if (!component) {
return;
}
route.push({
name,
name: lang + '/' + path,
component,
path: `/${lang}${path}`,
path: `/${lang}/${path}`,
meta: {
lang,
name: page.title

Some files were not shown because too many files have changed in this diff Show More