forked from vueComponent/ant-design-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
223 lines (221 loc) · 7.76 KB
/
index.js
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/* eslint-disable import/no-unresolved */
import Layout from '../layouts/index.vue';
import Iframe from '../layouts/Iframe.vue';
// import Iframe from '../components/iframe.jsx';
import demoRoutes from './demoRoutes';
// import otherRoutes from './otherRoutes';
import { createRouter, createWebHistory } from 'vue-router';
const routes = [
// ...otherRoutes,
{
path: '/components',
component: Layout,
children: [
{
path: 'overview:lang(.*)',
component: () => import('../views/ComponentOverview.vue'),
},
...demoRoutes,
],
},
{
path: '/iframe',
component: Iframe,
children: [
{
path: 'layout:lang(.*)',
meta: {
category: 'Components',
subtitle: '布局',
type: '布局',
cols: 1,
title: 'Layout',
cover: 'https://gw.alipayobjects.com/zos/alicdn/hzEndUVEx/Layout.svg',
},
props: route => {
const hash = route.hash.replace('#', '');
return { iframeName: hash };
},
component: () => import('../../../components/layout/demo/index.vue'),
},
{
path: 'float-button:lang(.*)',
meta: {
category: 'Components',
subtitle: '悬浮按钮',
type: '悬浮按钮',
cols: 1,
title: 'FloatButton',
cover:
'https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*HS-wTIIwu0kAAAAAAAAAAAAADrJ8AQ/original',
},
props: route => {
const hash = route.hash.replace('#', '');
return { iframeName: hash };
},
component: () => import('../../../components/float-button/demo/index.vue'),
},
],
},
{
path: '/docs',
component: Layout,
// props: route => {
// const name = route.path.split('/docs/vue/')[1].split('/')[0];
// return { name, showApi: true };
// },
children: [
{
path: 'vue/introduce-cn',
meta: { enTitle: 'Ant Design of Vue', title: 'Ant Design of Vue', category: 'docs' },
component: () => import('../vueDocs/introduce.zh-CN.md'),
},
{
path: 'vue/introduce',
meta: { enTitle: 'Ant Design of Vue', title: 'Ant Design of Vue', category: 'docs' },
component: () => import('../vueDocs/introduce.en-US.md'),
},
{
path: 'vue/getting-started-cn',
meta: { enTitle: 'Getting Started', title: '快速上手', category: 'docs' },
component: () => import('../vueDocs/getting-started.zh-CN.md'),
},
{
path: 'vue/getting-started',
meta: { enTitle: 'Getting Started', title: '快速上手', category: 'docs' },
component: () => import('../vueDocs/getting-started.en-US.md'),
},
{
path: 'vue/compatible-style-cn',
meta: { enTitle: 'Compatible Style', title: '样式兼容', category: 'docs' },
component: () => import('../vueDocs/compatible-style.zh-CN.md'),
},
{
path: 'vue/compatible-style',
meta: { enTitle: 'Compatible Style', title: '样式兼容', category: 'docs' },
component: () => import('../vueDocs/compatible-style.en-US.md'),
},
{
path: 'vue/customize-theme-cn',
meta: { enTitle: 'Customize Theme', title: '定制主题', category: 'docs' },
component: () => import('../vueDocs/customize-theme.zh-CN.md'),
},
{
path: 'vue/customize-theme',
meta: { enTitle: 'Customize Theme', title: '定制主题', category: 'docs' },
component: () => import('../vueDocs/customize-theme.en-US.md'),
},
{
path: 'vue/customize-theme-variable-cn',
meta: { enTitle: 'Dynamic Theme (Experimental)', title: '动态主题', category: 'docs' },
component: () => import('../vueDocs/customize-theme-variable.zh-CN.md'),
},
{
path: 'vue/customize-theme-variable',
meta: { enTitle: 'Dynamic Theme (Experimental)', title: '动态主题', category: 'docs' },
component: () => import('../vueDocs/customize-theme-variable.en-US.md'),
},
{
path: 'vue/migration-v2-cn',
meta: { enTitle: 'V1 to V2', title: '从 v1 到 v2', category: 'docs' },
component: () => import('../vueDocs/migration-v2.zh-CN.md'),
},
{
path: 'vue/migration-v2',
meta: { enTitle: 'V1 to V2', title: '从 v1 到 v2', category: 'docs' },
component: () => import('../vueDocs/migration-v2.en-US.md'),
},
{
path: 'vue/migration-v3-cn',
meta: { enTitle: 'V2 to V3', title: '从 v2 到 v3', category: 'docs' },
component: () => import('../vueDocs/migration-v3.zh-CN.md'),
},
{
path: 'vue/migration-v3',
meta: { enTitle: 'V2 to V3', title: '从 v2 到 v3', category: 'docs' },
component: () => import('../vueDocs/migration-v3.en-US.md'),
},
{
path: 'vue/replace-date-cn',
meta: { enTitle: 'Custom Date Library', title: '自定义时间库', category: 'docs' },
component: () => import('../vueDocs/replace-date.zh-CN.md'),
},
{
path: 'vue/replace-date',
meta: { enTitle: 'Custom Date Library', title: '自定义时间库', category: 'docs' },
component: () => import('../vueDocs/replace-date.en-US.md'),
},
{
path: 'vue/i18n-cn',
meta: { enTitle: 'Internationalization', title: '国际化', category: 'docs' },
component: () => import('../vueDocs/i18n.zh-CN.md'),
},
{
path: 'vue/i18n',
meta: { enTitle: 'Internationalization', title: '国际化', category: 'docs' },
component: () => import('../vueDocs/i18n.en-US.md'),
},
{
path: 'vue/faq-cn',
meta: { enTitle: 'FAQ', title: '常见问题', category: 'docs' },
component: () => import('../vueDocs/faq.zh-CN.md'),
},
{
path: 'vue/faq',
meta: { enTitle: 'FAQ', title: '常见问题', category: 'docs' },
component: () => import('../vueDocs/faq.en-US.md'),
},
{
path: 'vue/download-cn',
meta: { enTitle: 'Download Design Resources', title: '下载设计资源', category: 'docs' },
component: () => import('../vueDocs/download.zh-CN.md'),
},
{
path: 'vue/download',
meta: { enTitle: 'Download Design Resources', title: '下载设计资源', category: 'docs' },
component: () => import('../vueDocs/download.en-US.md'),
},
{
path: 'vue/sponsor-cn',
meta: { enTitle: 'Sponsor', title: '支持我们', category: 'docs' },
component: () => import('../vueDocs/sponsor.zh-CN.md'),
},
{
path: 'vue/sponsor',
meta: { enTitle: 'Sponsor', title: '支持我们', category: 'docs' },
component: () => import('../vueDocs/sponsor.en-US.md'),
},
{
path: 'vue/changelog-cn',
meta: { enTitle: 'Change Log', title: '更新日志', category: 'docs' },
component: () => import('../../../CHANGELOG.zh-CN.md'),
},
{
path: 'vue/changelog',
meta: { enTitle: 'Change Log', title: '更新日志', category: 'docs' },
component: () => import('../../../CHANGELOG.en-US.md'),
},
{ path: '', redirect: '/docs/vue/introduce/' },
],
},
{
path: '/theme-editor',
component: () => import('../views/theme-editor/index.vue'),
},
{
path: '/theme-editor-cn',
component: () => import('../views/theme-editor/index.vue'),
},
{ path: '/debugger', component: () => import('../../debugger') },
{ path: '/:lang(.*)', redirect: '/components/overview' },
];
export default createRouter({
history: createWebHistory(),
fallback: false,
routes,
scrollBehavior: to => {
if (to.hash) {
return { el: to.hash, top: 80, behavior: 'auto' };
}
},
});