fix: 统一代码格式

This commit is contained in:
xingyu4j
2025-10-21 14:34:05 +08:00
parent 7f7f7cda2b
commit e5d69952cb

View File

@@ -48,23 +48,23 @@ export function getNestedValue<T>(obj: T, path: string): any {
* @param key 参数键名 * @param key 参数键名
* @param urlStr 链接地址,默认为当前浏览器的地址 * @param urlStr 链接地址,默认为当前浏览器的地址
*/ */
export const getUrlNumberValue = ( export function getUrlNumberValue(
key: string, key: string,
urlStr: string = location.href, urlStr: string = location.href,
): number => { ): number {
return Number(getUrlValue(key, urlStr)); return Number(getUrlValue(key, urlStr));
}; }
/** /**
* 获取链接的参数值 * 获取链接的参数值
* @param key 参数键名 * @param key 参数键名
* @param urlStr 链接地址,默认为当前浏览器的地址 * @param urlStr 链接地址,默认为当前浏览器的地址
*/ */
export const getUrlValue = ( export function getUrlValue(
key: string, key: string,
urlStr: string = location.href, urlStr: string = location.href,
): string => { ): string {
if (!urlStr || !key) return ''; if (!urlStr || !key) return '';
const url = new URL(decodeURIComponent(urlStr)); const url = new URL(decodeURIComponent(urlStr));
return url.searchParams.get(key) ?? ''; return url.searchParams.get(key) ?? '';
}; }