Skip to content

getURLParameters

getURLParameters(url): Record<string, string>

获取 URL 参数

解析 URL 中的查询参数

Parameters

NameTypeDescription
urlstring要解析的 URL

Returns

Record<string, string>

包含所有参数的对象

Example

ts
getURLParameters('https://example.com?name=John&age=30');
// 返回 { name: 'John', age: '30' }

Released under the MIT License.