用法
hasQueryParam 函数用于检查 URL 是否包含指定查询参数。
import { hasQueryParam } from '@movk/core'
hasQueryParam('https://example.com?page=1', 'page') // true
hasQueryParam('https://example.com?page=1', 'sort') // false
hasQueryParam('https://example.com?flag', 'flag') // true (无值参数)
API
hasQueryParam(url, key)
检查 URL 是否包含指定查询参数。
参数
url
string required
URL 字符串。
key
string required
参数名。
返回值
返回值
boolean
是否包含该参数。
Changelog
No recent changes