@@ -4,13 +4,11 @@ import type { OverlayScrollbarsComponentRef } from 'overlayscrollbars-vue'
4
4
import { OverlayScrollbarsComponent } from ' overlayscrollbars-vue'
5
5
import { cloneDeep } from ' lodash-es'
6
6
import hotkeys from ' hotkeys-js'
7
- import type { RouteRecordRaw } from ' vue-router'
8
7
import Breadcrumb from ' ../Breadcrumb/index.vue'
9
8
import BreadcrumbItem from ' ../Breadcrumb/item.vue'
10
9
import { resolveRoutePath } from ' @/utils'
11
10
import eventBus from ' @/utils/eventBus'
12
11
import useSettingsStore from ' @/store/modules/settings'
13
- import useRouteStore from ' @/store/modules/route'
14
12
import useMenuStore from ' @/store/modules/menu'
15
13
import type { Menu } from ' @/types/global'
16
14
@@ -40,7 +38,6 @@ const transitionClass = computed(() => {
40
38
41
39
const router = useRouter ()
42
40
const settingsStore = useSettingsStore ()
43
- const routeStore = useRouteStore ()
44
41
const menuStore = useMenuStore ()
45
42
46
43
interface listTypes {
@@ -149,34 +146,27 @@ onMounted(() => {
149
146
150
147
function initSourceList() {
151
148
sourceList .value = []
152
- if (settingsStore .settings .app .routeBaseOn !== ' filesystem' ) {
153
- routeStore .routes .forEach ((item ) => {
154
- item .children && getSourceList (item .children as RouteRecordRaw [])
155
- })
156
- }
157
- else {
158
- menuStore .menus .forEach ((item ) => {
159
- getSourceListByMenus (item .children )
160
- })
161
- }
149
+ menuStore .allMenus .forEach ((item ) => {
150
+ getSourceListByMenus (item .children )
151
+ })
162
152
}
163
153
164
- function hasChildren(item : RouteRecordRaw ) {
154
+ function hasChildren(item : Menu . recordRaw ) {
165
155
let flag = true
166
156
if (item .children ?.every (i => i .meta ?.menu === false )) {
167
157
flag = false
168
158
}
169
159
return flag
170
160
}
171
- function getSourceList (arr : RouteRecordRaw [], basePath ? : string , icon ? : string , breadcrumb ? : { title? : string | (() => string ) }[]) {
161
+ function getSourceListByMenus (arr : Menu . recordRaw [], basePath ? : string , icon ? : string , breadcrumb ? : { title? : string | (() => string ) }[]) {
172
162
arr .forEach ((item ) => {
173
163
if (item .meta ?.menu !== false ) {
174
164
const breadcrumbTemp = cloneDeep (breadcrumb ) || []
175
165
if (item .children && hasChildren (item )) {
176
166
breadcrumbTemp .push ({
177
167
title: item .meta ?.title ,
178
168
})
179
- getSourceList (item .children , resolveRoutePath (basePath , item .path ), item .meta ?.icon ?? icon , breadcrumbTemp )
169
+ getSourceListByMenus (item .children , resolveRoutePath (basePath , item .path ), item .meta ?.icon ?? icon , breadcrumbTemp )
180
170
}
181
171
else {
182
172
breadcrumbTemp .push ({
@@ -193,28 +183,6 @@ function getSourceList(arr: RouteRecordRaw[], basePath?: string, icon?: string,
193
183
}
194
184
})
195
185
}
196
- function getSourceListByMenus(arr : Menu .recordRaw [], icon ? : string , breadcrumb ? : { title? : string | (() => string ) }[]) {
197
- arr .forEach ((item ) => {
198
- const breadcrumbTemp = cloneDeep (breadcrumb ) || []
199
- if (item .children && item .children .length > 0 ) {
200
- breadcrumbTemp .push ({
201
- title: item .meta ?.title ,
202
- })
203
- getSourceListByMenus (item .children , item .meta ?.icon ?? icon , breadcrumbTemp )
204
- }
205
- else {
206
- breadcrumbTemp .push ({
207
- title: item .meta ?.title ,
208
- })
209
- sourceList .value .push ({
210
- icon: item .meta ?.icon ?? icon ,
211
- title: item .meta ?.title ,
212
- path: item .path as string ,
213
- breadcrumb: breadcrumbTemp ,
214
- })
215
- }
216
- })
217
- }
218
186
219
187
function keyUp() {
220
188
if (resultList .value .length ) {
0 commit comments