removeQueryParam

删除 URL 的指定查询参数

用法

removeQueryParam 函数用于删除 URL 的指定查询参数。

import { removeQueryParam } from '@movk/core'

removeQueryParam('https://example.com?page=1&sort=name', 'page')
// 'https://example.com?sort=name'

removeQueryParam('https://example.com?page=1', 'page')
// 'https://example.com'

API

removeQueryParam(url, key)

删除 URL 的指定查询参数。

参数

url
string required
URL 字符串。
key
string required
要删除的参数名。

返回值

返回值
string
新的 URL 字符串。

Changelog

7c832 — refactor!: 重构模块架构,拆分 utils 为专业化模块

Copyright © 2024 - 2026 YiXuan - MIT License