perf: 将 getUrlValue 放入 vben/utils 下
This commit is contained in:
@@ -42,3 +42,13 @@ export function getNestedValue<T>(obj: T, path: string): any {
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 URL 参数值
|
||||
* @param key - 参数键
|
||||
* @returns 参数值,或者未找到时返回空字符串
|
||||
*/
|
||||
export function getUrlValue(key: string): string {
|
||||
const url = new URL(decodeURIComponent(location.href));
|
||||
return url.searchParams.get(key) ?? '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user