Lines 72-78
export const useNavigationStore = defineStore("navigation", {
Link Here
|
72 |
getters: { |
72 |
getters: { |
73 |
breadcrumbs() { |
73 |
breadcrumbs() { |
74 |
if (this.current) |
74 |
if (this.current) |
75 |
return _buildFromCurrentMatches(this.current, this.routeState); |
75 |
return _buildFromCurrentMatches( |
|
|
76 |
this.current, |
77 |
this.routeState, |
78 |
this.params |
79 |
); |
76 |
|
80 |
|
77 |
return _getBaseElements(this.routeState); |
81 |
return _getBaseElements(this.routeState); |
78 |
|
82 |
|
Lines 100-113
export const useNavigationStore = defineStore("navigation", {
Link Here
|
100 |
); |
104 |
); |
101 |
} |
105 |
} |
102 |
|
106 |
|
103 |
function _buildFromCurrentMatches(currentMatches, routeState) { |
107 |
function _buildFromCurrentMatches( |
|
|
108 |
currentMatches, |
109 |
routeState, |
110 |
params |
111 |
) { |
104 |
return [ |
112 |
return [ |
105 |
{ |
113 |
{ |
106 |
...routeState, |
114 |
...routeState, |
107 |
icon: null, |
115 |
icon: null, |
108 |
children: null, |
116 |
children: null, |
109 |
}, |
117 |
}, |
110 |
..._mapMatches(currentMatches), |
118 |
..._mapMatches(currentMatches, params), |
111 |
]; |
119 |
]; |
112 |
} |
120 |
} |
113 |
|
121 |
|
Lines 115-129
export const useNavigationStore = defineStore("navigation", {
Link Here
|
115 |
return child.is_base || (child.path && child.path !== ""); |
123 |
return child.is_base || (child.path && child.path !== ""); |
116 |
} |
124 |
} |
117 |
|
125 |
|
118 |
function _mapMatches(currentMatches) { |
126 |
function _hasTitle(child) { |
|
|
127 |
return !!child.title; |
128 |
} |
129 |
|
130 |
function _getPath(match, params) { |
131 |
if (match.path && params) { |
132 |
return match.path.replaceAll( |
133 |
/(:(\w+))/g, |
134 |
(text, first_match, second_match) => { |
135 |
return params[second_match]; |
136 |
} |
137 |
); |
138 |
} |
139 |
} |
140 |
|
141 |
function _mapMatches(currentMatches, params) { |
119 |
return currentMatches |
142 |
return currentMatches |
120 |
.filter(match => _isBaseOrNotStub(match.meta.self)) |
143 |
.filter( |
121 |
.map(match => ({ |
144 |
match => |
122 |
...match.meta.self, |
145 |
_isBaseOrNotStub(match.meta.self) && |
123 |
icon: null, |
146 |
_hasTitle(match.meta.self) |
124 |
path: match.path, |
147 |
) |
125 |
children: null, |
148 |
.map(match => { |
126 |
})); |
149 |
let path = _getPath(match, params); |
|
|
150 |
return { |
151 |
...match.meta.self, |
152 |
icon: null, |
153 |
path, |
154 |
children: null, |
155 |
}; |
156 |
}); |
127 |
} |
157 |
} |
128 |
}, |
158 |
}, |
129 |
leftNavigation() { |
159 |
leftNavigation() { |
130 |
- |
|
|