From 38c1b12b079c36ee933c441775226b3f6c74450b Mon Sep 17 00:00:00 2001 From: asd Date: Wed, 8 Sep 2021 21:59:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=B3=A8=E5=86=8C=E8=B7=AF?= =?UTF-8?q?=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/route/index.ts | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/src/route/index.ts b/src/route/index.ts index 4f1bb1e..0990f46 100644 --- a/src/route/index.ts +++ b/src/route/index.ts @@ -1,20 +1,33 @@ -import { createRouter,createWebHashHistory, RouteRecord} from "vue-router"; -import {zujian} from "../page/install" -interface routesgeshi{ - path:String, - name:String, - component:object -} +import { createRouter,createWebHashHistory} from "vue-router"; let routes1 :Array=[] +const files:any = import.meta.globEager('/src/page/*.vue') +console.log(files) +// for(let i in files){ +// console.log(files[i].default) +// } + +for(let i in files){ + if(files.hasOwnProperty(i)){ + console.log(i) + routes1.push({ + path:"/"+files[i].default.name, + name:files[i].default.name, + component:files[i].default + }) + } -for(let i in zujian){ - console.log(i) - routes1.push({ - path:"/"+zujian[i].name, - name:zujian[i].name, - component:zujian[i] - }) } + +// for(let i in zujian){ +// console.log(i) +// routes1.push({ +// path:"/"+zujian[i].name, +// name:zujian[i].name, +// component:zujian[i] +// }) +// } + + // console.log(routes1) // console.log(zujian, typeof zujian) // const routes = [