|
@@ -73,6 +73,15 @@ export async function setFilterMenuAndCacheTagsViewRoutes() {
|
|
|
*/
|
|
|
export function setCacheTagsViewRoutes() {
|
|
|
const storesTagsView = useTagsViewRoutes(pinia);
|
|
|
+ /*
|
|
|
+ 是一个用于设置标签视图路由的函数,它的参数是一个动态路由的格式化后的二级路由的第一个子路由。
|
|
|
+ 具体来说,该函数的参数是:
|
|
|
+ 首先,将动态路由格式化为扁平化路由:formatFlatteningRoutes(dynamicRoutes);
|
|
|
+ 然后,将扁平化路由格式化为二级路由:formatTwoStageRoutes(formatFlatteningRoutes(dynamicRoutes));
|
|
|
+ 最后,取出二级路由的第一个子路由:formatTwoStageRoutes(formatFlatteningRoutes(dynamicRoutes))[0].children。
|
|
|
+ 因此,storesTagsView.setTagsViewRoutes(formatTwoStageRoutes(formatFlatteningRoutes(dynamicRoutes))[0].children) 的作用是将动态路由格式化为二级路由,
|
|
|
+ 并将其第一个子路由设置为标签视图路由。
|
|
|
+ */
|
|
|
storesTagsView.setTagsViewRoutes(formatTwoStageRoutes(formatFlatteningRoutes(dynamicRoutes))[0].children);
|
|
|
}
|
|
|
|
|
@@ -151,7 +160,9 @@ export function backEndComponent(routes: any) {
|
|
|
export function dynamicImport(dynamicViewsModules: Record<string, Function>, component: string) {
|
|
|
const keys = Object.keys(dynamicViewsModules);
|
|
|
const matchKeys = keys.filter((key) => {
|
|
|
+ //这是一个 JavaScript 语句,用于替换字符串 key 中的 ../views 或 ../ 为空字符串,并将结果赋值给变量 k。
|
|
|
const k = key.replace(/..\/views|../, '');
|
|
|
+ //这是一个 JavaScript 语句,它的作用是检查 k 是否以 component 或 /component 开头,如果是,则返回 true,否则返回 false。
|
|
|
return k.startsWith(`${component}`) || k.startsWith(`/${component}`);
|
|
|
});
|
|
|
if (matchKeys?.length === 1) {
|