Compare commits
2 Commits
df77d132d1
...
0b6b01102e
| Author | SHA1 | Date |
|---|---|---|
|
|
0b6b01102e | |
|
|
a0da7b943e |
|
|
@ -0,0 +1,3 @@
|
|||
<template>
|
||||
<svg t="1766560994032" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7332" width="256" height="256"><path d="M869 119.3H156.8c-36.4 0-66 29.6-66 66v657.9c0 36.4 29.6 66 66 66H869c36.4 0 66-29.6 66-66V185.3c0-36.4-29.6-66-66-66z m-4 70v176.6H160.8V189.3H865z m0 246.6V602H160.8V435.9H865zM160.8 839.2V672H865v167.2H160.8z" p-id="7333"></path><path d="M723.5 317.8h43c19.3 0 35-15.7 35-35s-15.7-35-35-35h-43c-19.3 0-35 15.7-35 35s15.7 35 35 35zM723.5 553.9h43c19.3 0 35-15.7 35-35s-15.7-35-35-35h-43c-19.3 0-35 15.7-35 35 0 19.4 15.7 35 35 35zM766.5 720.1h-43c-19.3 0-35 15.7-35 35s15.7 35 35 35h43c19.3 0 35-15.7 35-35 0-19.4-15.7-35-35-35z" p-id="7334"></path></svg>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<template>
|
||||
<svg t="1766561763272" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11104" width="256" height="256"><path d="M863.008 384C916.576 384 960 341.024 960 288V160c0-53.024-43.424-96-96.992-96H160.992C107.424 64 64 106.976 64 160v128c0 53.024 43.424 96 96.992 96H320v128a32 32 0 0 0 32 32h288v96H160.992C107.424 640 64 682.976 64 736v128c0 53.024 43.424 96 96.992 96h702.016C916.576 960 960 917.024 960 864v-128c0-53.024-43.424-96-96.992-96H704v-128a32 32 0 0 0-32-32h-288v-96h479.008z m0 320c17.856 0 32.32 14.336 32.32 32v128c0 17.664-14.464 32-32.32 32H160.992c-17.856 0-32.32-14.336-32.32-32v-128c0-17.664 14.464-32 32.32-32h702.016zM128.672 288V160c0-17.664 14.464-32 32.32-32h702.016c17.856 0 32.32 14.336 32.32 32v128c0 17.664-14.464 32-32.32 32H160.992c-17.856 0-32.32-14.336-32.32-32z" p-id="11105"></path><path d="M320 832h384a32 32 0 0 0 0-64H320a32 32 0 0 0 0 64zM736 224a32 32 0 0 0-32-32H320a32 32 0 0 0 0 64h384a32 32 0 0 0 32-32z" p-id="11106"></path></svg>
|
||||
</template>
|
||||
|
|
@ -58,12 +58,13 @@ export function filterAsyncRouter(routerMap) {
|
|||
}
|
||||
|
||||
export function loadComponent(component: string) {
|
||||
// 替换路径中的动态参数(例如 :id, :name)
|
||||
component = component.replace(/\/(:\w+)/g, '')
|
||||
// 构建可能的路径
|
||||
const fullPath = `/src/views/${component}.vue`
|
||||
const fullPathWithIndex = `/src/views/${component}/index.vue`
|
||||
// 先尝试直接路径,再尝试添加/index的路径
|
||||
const module = modules[fullPath] || modules[fullPathWithIndex]
|
||||
return module || notFound
|
||||
return modules[fullPath] || modules[fullPathWithIndex] || notFound
|
||||
}
|
||||
|
||||
//路由扁平化
|
||||
|
|
|
|||
Loading…
Reference in New Issue