routes.js
3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import DefaultLayout from '@/views/layout/default';
import ComponentLayout from '@/views/layout/component';
// 开发指南的文档
const _guides = [
{
path: 'introduce',
name: 'introduce',
meta: { title: '简介' },
component: () => import('@/views/docs/guide/introduce.md'),
},
{
path: 'installation',
name: 'installation',
meta: { title: '安装' },
component: () => import('@/views/docs/guide/installation.md'),
},
{
path: 'specification',
name: 'specification',
meta: { title: '说明' },
component: () => import('@/views/docs/guide/specification.md'),
},
];
// 组件页面的文档
const _components = [
{
group: '基础组件',
children: [
{
path: 'button',
name: 'button',
meta: { title: 'Button 按钮' },
component: () => import('@/views/docs/component/button.md'),
},
{
path: 'cell',
name: 'cell',
meta: { title: 'Cell 单元格' },
component: () => import('@/views/docs/component/cell.md'),
},
{
path: 'icon',
name: 'icon',
meta: { title: 'Icon 图标' },
component: () => import('@/views/docs/component/icon.md'),
},
]
},
{
group: '表单组件',
children: [
{
path: 'checkbox',
name: 'checkbox',
meta: { title: 'Checkbox 复选框' },
component: () => import('@/views/docs/component/checkbox.md'),
},
]
},
{
group: '展示组件',
children: [
{
path: 'steps',
name: 'steps',
meta: { title: 'Steps 步骤条' },
component: () => import('@/views/docs/component/steps.md'),
},
{
path: 'tag',
name: 'tag',
meta: { title: 'Tag 标签' },
component: () => import('@/views/docs/component/tag.md'),
},
]
},
{
group: '反馈组件',
children: [
{
path: 'popup',
name: 'popup',
meta: { title: 'Popup 弹出框' },
component: () => import('@/views/docs/component/popup.md'),
},
{
path: 'loading',
name: 'loading',
meta: { title: 'Loading 加载' },
component: () => import('@/views/docs/component/loading.md'),
},
]
},
{
group: '导航组件',
children: [
{
path: 'nav-bar',
name: 'nav-bar',
meta: { title: 'NavBar 导航栏' },
component: () => import('@/views/docs/component/nav-bar.md'),
},
{
path: 'tab-bar',
name: 'tab-bar',
meta: { title: 'TabBar 标签栏' },
component: () => import('@/views/docs/component/tab-bar.md'),
},
]
},
];
const _others = [
{
path: 'other',
name: 'other',
meta: { title: '其它' },
component: () => import('@/views/page/other'),
},
];
let _components_children = [];
_components.forEach(data => {
_components_children = [..._components_children, ...data.children]
});
// 用于导航的页面
const _pages = [
{
path: '',
meta: { title: '首页', path: '/index' },
component: DefaultLayout,
redirect: 'index',
children: [{
path: 'index',
name: 'index',
component: () => import('@/views/page/index'),
}],
},
{
path: '/component',
name: 'component',
meta: { title: '组件', path: '/component' },
component: ComponentLayout,
redirect: `/component/${_guides[0].path || 'detail'}`,
children: [..._components_children, ..._guides, ..._others]
}
]
export const pages = _pages;
export const guides = _guides;
export const components = _components;
export const others = _others;
export default [
{ path: '*', redirect: '/404', hidden: true },
{
path: '/404',
name: '404',
component: () => import('@/views/page/error/404')
},
..._pages,
];