From b9576eee0d7b0852f27d0ef387c150a5c210bc0f Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 13 Aug 2018 10:11:17 +0800 Subject: [PATCH] [Doc] reduce config file (#412) --- docs/src/doc.config.js | 114 +---------------------- example/app.json | 4 +- example/config.js | 111 ++++++++++++++++++++++ example/pages/{layout => col}/index.js | 0 example/pages/{layout => col}/index.json | 0 example/pages/{layout => col}/index.wxml | 0 example/pages/{layout => col}/index.wxss | 0 example/pages/dashboard/config.js | 107 --------------------- example/pages/dashboard/index.js | 2 +- example/pages/dashboard/index.wxml | 10 +- 10 files changed, 124 insertions(+), 224 deletions(-) create mode 100644 example/config.js rename example/pages/{layout => col}/index.js (100%) rename example/pages/{layout => col}/index.json (100%) rename example/pages/{layout => col}/index.wxml (100%) rename example/pages/{layout => col}/index.wxss (100%) delete mode 100644 example/pages/dashboard/config.js diff --git a/docs/src/doc.config.js b/docs/src/doc.config.js index 23d8aaed..2370040f 100644 --- a/docs/src/doc.config.js +++ b/docs/src/doc.config.js @@ -1,7 +1,9 @@ /* eslint-disable */ -const version = require('../../package.json').version; +import packageJson from '../../package.json'; +import components from '../../example/config'; +const { version } = packageJson; -module.exports = { +export default { header: { logo: { image: 'https://img.yzcdn.cn/public_files/2017/12/18/fd78cf6bb5d12e2a119d0576bedfd230.png', @@ -43,113 +45,7 @@ module.exports = { }, { name: '组件', - groups: [ - { - groupName: '基础组件', - list: [ - { - path: '/col', - title: 'Layout 布局' - }, - { - path: '/badge', - title: 'Badge 徽章' - }, - { - path: '/button', - title: 'Button 按钮' - }, - { - path: '/cell', - title: 'Cell 单元格' - }, - { - path: '/icon', - title: 'Icon 图标' - }, - { - path: '/loading', - title: 'Loading 加载' - }, - { - path: '/nav-bar', - title: 'NavBar 导航栏' - }, - { - path: '/notice-bar', - title: 'NoticeBar 通告栏' - }, - { - path: '/panel', - title: 'Panel 面板' - }, - { - path: '/popup', - title: 'Popup 弹出层' - }, - { - path: '/steps', - title: 'Steps 步骤条' - }, - { - path: '/tag', - title: 'Tag 标记' - } - ] - }, - { - groupName: '表单组件', - list: [ - { - path: '/field', - title: 'Field 输入框' - }, - { - path: '/search', - title: 'Search 搜索' - }, - { - path: '/stepper', - title: 'Stepper 步进器' - }, - { - path: '/switch', - title: 'Switch 开关' - } - ] - }, - { - groupName: '操作反馈', - list: [ - { - path: '/actionsheet', - title: 'Actionsheet 上拉菜单' - }, - { - path: '/notify', - title: 'Notify 消息通知' - } - ] - }, - { - groupName: '高阶组件', - list: [ - { - path: '/tree-select', - title: 'TreeSelect 分类选择' - } - ] - }, - { - groupName: '业务组件', - list: [ - { - path: '/card', - title: 'Card 卡片' - } - ] - } - ] + groups: components } ] }; diff --git a/example/app.json b/example/app.json index fc06d523..3ad7b9c2 100644 --- a/example/app.json +++ b/example/app.json @@ -6,9 +6,9 @@ "pages/button/index", "pages/card/index", "pages/cell/index", + "pages/col/index", "pages/field/index", "pages/icon/index", - "pages/layout/index", "pages/loading/index", "pages/nav-bar/index", "pages/notice-bar/index", @@ -23,7 +23,7 @@ "pages/tree-select/index" ], "window": { - "navigationBarBackgroundColor": "#FAFAFA", + "navigationBarBackgroundColor": "#f8f8f8", "navigationBarTitleText": "Vant Weapp", "navigationBarTextStyle": "black", "backgroundTextStyle": "dark", diff --git a/example/config.js b/example/config.js new file mode 100644 index 00000000..60e729e0 --- /dev/null +++ b/example/config.js @@ -0,0 +1,111 @@ +export default [ + { + groupName: '基础组件', + list: [ + { + path: '/col', + title: 'Layout 布局' + }, + { + path: '/badge', + title: 'Badge 徽章' + }, + { + path: '/button', + title: 'Button 按钮' + }, + { + path: '/cell', + title: 'Cell 单元格' + }, + { + path: '/icon', + title: 'Icon 图标' + }, + { + path: '/loading', + title: 'Loading 加载' + }, + { + path: '/nav-bar', + title: 'NavBar 导航栏' + }, + { + path: '/notice-bar', + title: 'NoticeBar 通告栏' + }, + { + path: '/panel', + title: 'Panel 面板' + }, + { + path: '/popup', + title: 'Popup 弹出层' + }, + { + path: '/steps', + title: 'Steps 步骤条' + }, + { + path: '/tag', + title: 'Tag 标记' + } + ] + }, + { + groupName: '表单组件', + list: [ + { + path: '/field', + title: 'Field 输入框' + }, + { + path: '/search', + title: 'Search 搜索' + }, + { + path: '/stepper', + title: 'Stepper 步进器' + }, + { + path: '/switch', + title: 'Switch 开关' + } + ] + }, + { + groupName: '操作反馈', + list: [ + { + path: '/actionsheet', + title: 'Actionsheet 上拉菜单' + }, + { + path: '/notify', + title: 'Notify 消息通知' + }, + { + path: '/toast', + title: 'Toast 轻提示' + } + ] + }, + { + groupName: '高阶组件', + list: [ + { + path: '/tree-select', + title: 'TreeSelect 分类选择' + } + ] + }, + { + groupName: '业务组件', + list: [ + { + path: '/card', + title: 'Card 卡片' + } + ] + } +]; diff --git a/example/pages/layout/index.js b/example/pages/col/index.js similarity index 100% rename from example/pages/layout/index.js rename to example/pages/col/index.js diff --git a/example/pages/layout/index.json b/example/pages/col/index.json similarity index 100% rename from example/pages/layout/index.json rename to example/pages/col/index.json diff --git a/example/pages/layout/index.wxml b/example/pages/col/index.wxml similarity index 100% rename from example/pages/layout/index.wxml rename to example/pages/col/index.wxml diff --git a/example/pages/layout/index.wxss b/example/pages/col/index.wxss similarity index 100% rename from example/pages/layout/index.wxss rename to example/pages/col/index.wxss diff --git a/example/pages/dashboard/config.js b/example/pages/dashboard/config.js deleted file mode 100644 index 29e3681b..00000000 --- a/example/pages/dashboard/config.js +++ /dev/null @@ -1,107 +0,0 @@ -export default { - base: { - title: '基础组件', - content: [ - { - name: 'Layout 布局', - path: '/pages/layout/index' - }, - { - name: 'Badge 徽章', - path: '/pages/badge/index' - }, - { - name: 'Button 按钮', - path: '/pages/button/index' - }, - { - name: 'Cell 单元格', - path: '/pages/cell/index' - }, - { - name: 'Icon 图标', - path: '/pages/icon/index' - }, - { - name: 'Loading 加载', - path: '/pages/loading/index' - }, - { - name: 'NavBar 导航栏', - path: '/pages/nav-bar/index' - }, - { - name: 'NoticeBar 通告栏', - path: '/pages/notice-bar/index' - }, - { - name: 'Panel 面板', - path: '/pages/panel/index' - }, - { - name: 'Popup 弹出层', - path: '/pages/popup/index' - }, - { - name: 'Steps 步骤条', - path: '/pages/steps/index' - }, - { - name: 'Tag 标记', - path: '/pages/tag/index' - } - ] - }, - form: { - title: '表单', - content: [ - { - name: 'Field 输入框', - path: '/pages/field/index' - }, - { - name: 'Search 搜索', - path: '/pages/search/index' - }, - { - name: 'Stepper 步进器', - path: '/pages/stepper/index' - }, - { - name: 'Switch 开关', - path: '/pages/switch/index' - } - ] - }, - action: { - title: '操作反馈', - content: [ - { - name: 'Actionsheet 上拉菜单', - path: '/pages/actionsheet/index' - }, - { - name: 'Notify 消息提示', - path: '/pages/notify/index' - } - ] - }, - high: { - title: '高阶组件', - content: [ - { - name: 'TresSelect 分类选择', - path: '/pages/tree-select/index' - } - ] - }, - bussiness: { - title: '业务组件', - content: [ - { - name: 'Card 卡片', - path: '/pages/card/index' - } - ] - } -}; diff --git a/example/pages/dashboard/index.js b/example/pages/dashboard/index.js index 51b5eb26..cb27bd85 100644 --- a/example/pages/dashboard/index.js +++ b/example/pages/dashboard/index.js @@ -1,4 +1,4 @@ -import config from './config'; +import config from '../../config'; import Page from '../../common/page'; Page({ diff --git a/example/pages/dashboard/index.wxml b/example/pages/dashboard/index.wxml index 4a685c43..8ee64a1b 100644 --- a/example/pages/dashboard/index.wxml +++ b/example/pages/dashboard/index.wxml @@ -7,15 +7,15 @@ - {{ group.title }} + {{ group.groupName }}