1
- import { RouteRecordRaw , createRouter , createWebHistory } from " vue-router" ;
2
- import config from " ./sites.config" ;
1
+ import { RouteRecordRaw , createRouter , createWebHistory } from ' vue-router' ;
2
+ import config from ' ./sites.config' ;
3
3
4
4
// const demoReq = require.context("@/", true, /demos[/\\][\w-]+\.vue$/im);
5
5
@@ -8,7 +8,7 @@ const navs = config.navs;
8
8
function getDocsRoutes ( docs : any [ ] , type : string ) : RouteRecordRaw [ ] {
9
9
let docsRoutes : Array < RouteRecordRaw > = [ ] ;
10
10
11
- docs . forEach ( item => {
11
+ docs . forEach ( ( item ) => {
12
12
const docType = item . type || type ;
13
13
if ( docType === type ) {
14
14
if ( item . children ) {
@@ -17,21 +17,20 @@ function getDocsRoutes(docs: any[], type: string): RouteRecordRaw[] {
17
17
docsRoutes . push ( {
18
18
path : `/components/${ item . name } ` ,
19
19
name : item . name ,
20
- component : item . component
20
+ component : item . component ,
21
21
} ) ;
22
22
}
23
23
}
24
24
} ) ;
25
25
return docsRoutes ;
26
26
}
27
- console . log ( getDocsRoutes ( navs . components . docs , "component" ) ) ;
28
- // console.log(import("@/icon/icon.md"))
27
+ console . log ( getDocsRoutes ( navs . components . docs , 'component' ) ) ;
29
28
const routes : Array < RouteRecordRaw > = [
30
29
{
31
- path : "/" ,
32
- redirect : " /components/install"
30
+ path : '/' ,
31
+ redirect : ' /components/install' ,
33
32
} ,
34
- ...getDocsRoutes ( navs . components . docs , " component" )
33
+ ...getDocsRoutes ( navs . components . docs , ' component' ) ,
35
34
] ;
36
35
const router = createRouter ( {
37
36
history : createWebHistory ( process . env . BASE_URL ) ,
0 commit comments