@@ -7,6 +7,9 @@ let storageConfigStore = useStorageConfigStore();
7
7
import useRouterData from "~/composables/useRouterData" ;
8
8
let { fullpath, storageKey } = useRouterData ( ) ;
9
9
10
+ import useCommon from "~/composables/useCommon" ;
11
+ const { encodeAllIgnoreSlashes } = useCommon ( ) ;
12
+
10
13
// 面包屑数据
11
14
let breadcrumbData = ref ( [ ] ) ;
12
15
let initialized = false ;
@@ -16,7 +19,13 @@ export default function useBreadcrumb() {
16
19
17
20
// 构建面包屑
18
21
let buildBreadcrumbData = ( ) => {
19
- breadcrumbData . value = [ ] ;
22
+ breadcrumbData . value = [
23
+ {
24
+ name : storageConfigStore . globalConfig . siteHomeName || '首页' ,
25
+ href : rootPath . value ,
26
+ disable : false
27
+ }
28
+ ] ;
20
29
21
30
// 如果为包含根目录模式,则面包屑显示驱动器
22
31
if ( rootShowStorage ) {
@@ -25,7 +34,7 @@ export default function useBreadcrumb() {
25
34
if ( storageByKey ) {
26
35
breadcrumbData . value . push ( {
27
36
name : storageByKey . name ,
28
- fullPath : '/' + storageByKey . key
37
+ href : encodeAllIgnoreSlashes ( '/' + storageByKey . key )
29
38
} )
30
39
}
31
40
}
@@ -34,10 +43,10 @@ export default function useBreadcrumb() {
34
43
fullpath . value . forEach ( ( item , index , arr ) => {
35
44
let breadcrumbItem = {
36
45
name : item ,
37
- fullPath : removeDuplicateSlashes ( '/' + storageKey . value + '/' + arr . slice ( 0 , index + 1 ) . join ( '/' ) )
46
+ href : encodeAllIgnoreSlashes ( removeDuplicateSlashes ( '/' + storageKey . value + '/' + arr . slice ( 0 , index + 1 ) . join ( '/' ) ) ) ,
47
+ disable : index === arr . length - 1
38
48
}
39
49
breadcrumbData . value . push ( breadcrumbItem ) ;
40
-
41
50
} )
42
51
}
43
52
} ;
0 commit comments