feat(projects): add menu route field

This commit is contained in:
paynezhuang
2024-04-26 20:00:23 +08:00
parent a1920fcad9
commit dbe31eb1dc
7 changed files with 258 additions and 66 deletions

View File

@ -40,3 +40,21 @@ export function transformLayoutAndPageToComponent(layout: string, page: string)
return '';
}
export function transformToQueryObject(data: Record<string, string>[]) {
const query: Record<string, string> = {};
data.forEach(pair => {
if (pair.key && pair.value) {
query[pair.key] = pair.value;
}
});
return query;
}
export function transformToKeyValuePairs(query?: Record<string, string>) {
const safeQuery = query || {};
return Object.entries(safeQuery).map(([key, value]) => ({
key,
value
}));
}