mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-11-07 12:57:13 +08:00
refactor: http util and route store (#43)
This commit is contained in:
13
src/router/asyncModules.ts
Normal file
13
src/router/asyncModules.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
type ImportVueFileType = typeof import('*.vue')
|
||||
type ImportVueFileFnType = () => Promise<ImportVueFileType>
|
||||
|
||||
const moduleFiles = import.meta.glob<ImportVueFileType>('@/views/**/*.vue')
|
||||
|
||||
export const asyncRouteModules = Object.entries(moduleFiles).reduce((routes, [url, importFn]) => {
|
||||
if (!/\/(views\/login|components)\//.test(url)) {
|
||||
const path = url.replace('/src/views/', '').replace('.vue', '')
|
||||
routes[path] = importFn
|
||||
}
|
||||
|
||||
return routes
|
||||
}, {} as Recordable<ImportVueFileFnType>)
|
||||
Reference in New Issue
Block a user