File tree Expand file tree Collapse file tree 4 files changed +26
-11
lines changed Expand file tree Collapse file tree 4 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ function analysisRouteConfig(filepath) {
148148 var rePath = filepath . replace ( pages , "/" + _config . pagePath ) . replaceAll ( "\\" , "/" ) ; // 相对路径
149149 var routePath = rePath . replace ( "/" + _config . pagePath , "" ) . replace ( ".vue" , "" ) ; // 路由路径
150150 var routePathArr = routePath . split ( "/" ) ; // 相对路径转数组
151- var res = { } ;
151+ var res = "" ;
152152 var setRoute = function setRoute ( r ) {
153153 var res = null ;
154154 if ( ! r ) {
@@ -176,7 +176,14 @@ function analysisRouteConfig(filepath) {
176176 if ( ! config || ! config . route ) {
177177 return setRoute ( null ) ;
178178 } else if ( config . route ) {
179- if ( Array . isArray ( config . route ) ) { }
179+ if ( Array . isArray ( config . route ) ) {
180+ var result = [ ] ;
181+ config . route . forEach ( function ( item ) {
182+ result . push ( setRoute ( item ) ) ;
183+ } ) ;
184+ res = result . join ( "," ) ;
185+ } else res = setRoute ( config . route ) ;
186+ return res ;
180187 }
181188}
182189/**
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ function analysisRouteConfig(filepath){
128128 let rePath = filepath . replace ( pages , "/" + _config . pagePath ) . replaceAll ( "\\" , "/" ) ; // 相对路径
129129 let routePath = rePath . replace ( "/" + _config . pagePath , "" ) . replace ( ".vue" , "" ) ; // 路由路径
130130 let routePathArr = routePath . split ( "/" ) ; // 相对路径转数组
131- let res = { } ;
131+ let res = "" ;
132132 const setRoute = ( r ) => {
133133 let res = null ;
134134 if ( ! r ) {
@@ -156,9 +156,13 @@ function analysisRouteConfig(filepath){
156156 return setRoute ( null ) ;
157157 } else if ( config . route ) {
158158 if ( Array . isArray ( config . route ) ) {
159-
160- }
161-
159+ let result = [ ] ;
160+ config . route . forEach ( item => {
161+ result . push ( setRoute ( item ) ) ;
162+ } )
163+ res = result . join ( "," ) ;
164+ } else res = setRoute ( config . route ) ;
165+ return res ;
162166 }
163167}
164168/**
Original file line number Diff line number Diff line change 11{
22 "name" : " auto-router-vue3" ,
3- "version" : " 1.3.8 " ,
3+ "version" : " 1.3.10 " ,
44 "description" : " 生成router, 基于vue" ,
55 "main" : " libs/cjs/index.js" ,
66 "module" : " libs/es/index.mjs" ,
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ function analysisRouteConfig(filepath){
128128 let rePath = filepath . replace ( pages , "/" + _config . pagePath ) . replaceAll ( "\\" , "/" ) ; // 相对路径
129129 let routePath = rePath . replace ( "/" + _config . pagePath , "" ) . replace ( ".vue" , "" ) ; // 路由路径
130130 let routePathArr = routePath . split ( "/" ) ; // 相对路径转数组
131- let res = { } ;
131+ let res = "" ;
132132 const setRoute = ( r ) => {
133133 let res = null ;
134134 if ( ! r ) {
@@ -156,9 +156,13 @@ function analysisRouteConfig(filepath){
156156 return setRoute ( null ) ;
157157 } else if ( config . route ) {
158158 if ( Array . isArray ( config . route ) ) {
159-
160- }
161-
159+ let result = [ ] ;
160+ config . route . forEach ( item => {
161+ result . push ( setRoute ( item ) ) ;
162+ } )
163+ res = result . join ( ",\n" ) ;
164+ } else res = setRoute ( config . route ) ;
165+ return res ;
162166 }
163167}
164168/**
You can’t perform that action at this time.
0 commit comments