Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 2x 2x 2x 2x 2x 2x 2x 1x 1x |
/**
* 获取地址栏参数
* @param name
* @param url
*/
export function getQueryParam(name: string, url?: string): string | undefined {
Iif (typeof name !== 'string') {
return undefined;
}
Iif (typeof url === 'undefined') {
if (typeof window !== 'undefined') {
url = window.location.href;
}
}
Eif (typeof url === 'string') {
const reg = new RegExp(`(\\?|&)${name}=([^&]*)(&|$)`, "i");
const r = url.match(reg);
if (r !== null) {
return unescape(r[2]);
}
}
return undefined;
} |